Outputting all hashes generated by hashcat
#1
Question 
I'm trying to brute-force an encryption algorithm for some game. It takes a passphrase, hashes it with PBKDF2-HMAC-SHA1 (mode 12000), and then uses that as a key for encryption. This hash is pretty slow though, with my own Rust implementation on the CPU only it got about 11kH/s. 

That's where I wanted to use hashcat, as it can use the GPU to generate hashes way faster. Running a benchmark with 

Code:
hashcat -b -m 12000

it got around 2300kH/s, over 200x faster. The only problem is that I can't directly use hashcat to compare against some known hash, I have to first run the encryption algorithm using that guess of the key to see if the message decrypts. This decrypting is really fast though, the hash is really the bottleneck. 

One thing that would solve my problem is if hashcat had a way to output every single hash is generates, basically just hashing all the words you give it and putting them in a file. Then I would be able to use this file full of hashes for the next encryption step which is way faster. 

I could not find any way to output these hashes, but it should be as simple as making hashcat match everything, so it thinks everything is a correct hash so it outputs it. I thought there might be some 

Code:
bool compare() { return true; }
 

kind of function I could make, but I'm not a C programmer by any means and couldn't find anything in the source like it. 

If anyone has any idea's that would be great, if not, that's fine too. It's just a bit of practice for a random game after all. Thanks.
Reply
#2
you are right, there is no option for outputting generated hashes

you could open a github issue / feature request for this but anyways you miss something important here, generating the hashes is not the limiting factor, it is the output regardless whether to stdout or to a file (write operation) which will slow down any output to a specific maxwrite per second, so for 99% it really doesnt matter what kind of hash do you have or you want to compute your SSD/HDD is limiting your output and never the less, dont forget the great amount of storage you will need especially when bruteforcing

there are good reasons why rainbowtables (stored hashes) are obsolete nowadays
Reply
#3
It sounds like you're working on a challenging encryption problem for a game. It's great that you're exploring different tools and methods to optimize the process. Keep up the good work, and I hope you find a solution that works well for your needs!
Reply
#4
(10-19-2022, 09:19 AM)J0R1AN Wrote: I'm trying to brute-force an encryption algorithm for some game. It takes a passphrase, hashes it with PBKDF2-HMAC-SHA1 (mode 12000), and then uses that as a key for encryption. This hash is pretty slow though, with my own Rust implementation on the CPU only it got about 11kH/s. 

That's where I wanted to use hashcat, as it can use the GPU to generate hashes way faster. Running a benchmark with 

Code:
hashcat -b -m 12000

it got around 2300kH/s, over 200x faster. The only problem is that I can't directly use hashcat to compare against some known hash, I have to first run the encryption algorithm using that guess of the key to see if the message decrypts. This decrypting is really fast though, the hash is really the bottleneck. 

One thing that would solve my problem is if hashcat had a way to Run 3 output every single hash is generates, basically just hashing all the words you give it and putting them in a file. Then I would be able to use this file full of hashes for the next encryption step which is way faster. 

I could not find any way to output these hashes, but it should be as simple as making hashcat match everything, so it thinks everything is a correct hash so it outputs it. I thought there might be some 

Code:
bool compare() { return true; }
 

kind of function I could make, but I'm not a C programmer by any means and couldn't find anything in the source like it. 

If anyone has any idea's that would be great, if not, that's fine too. It's just a bit of practice for a random game after all. Thanks.

I must emphasize that modifying or extending the functionality of hashcat requires knowledge of C programming and modifying the source code, which is beyond the scope of this text-based conversation.
Reply
#5
Yeah unfortunately, this isn't a thing in current Hashcat and it may not be as easy as expected to do. Hashcat is highly specialised at what it does and it doesn't even generate the full hash in many circumstances so it'd require a lot of effort to get Hashcat's format back into something that you could easily use. Also, transferring the data from the GPU to a drive would be quite slow without a lot of effort to batch many of them up into a single package.
It would be possible to jank a solution into Hashcat but having a decent custom, multithreaded CPU-based generator would probably be many times easier and faster, especially with ChatGPT for the bits you're not sure what to do.
Reply
#6
I had a similar problem.  A situation where a pre salt was necessary to generate a hash that was applied to hashcat to be dehashed with result of hashcat outputting the hash as a solution.

Crappy solution

Use large amounts of HDD space.

Use python to output a second word list of hashes

Googled: https://asecuritysite.com/hash/ssid_hm?v...al2=oxtail.

File1 hashes
File2 hashes + original word

Run each hash through your decryption program

Once found/assuming it's found

Grep that hash into File2 to find original word

Hashcat had rules for dictionary variations but that's only if you don't have hits in the hash list.

A hashcat custom module would have worked too (for me) if I could remember how to code in C. If your decryption algorithm is in C that could be much faster, cleaner solution that could maybe work...
Reply
#7
(04-21-2024, 05:56 PM)jmeister234 Wrote: I had a similar problem.  A situation where a pre salt was necessary to generate a hash that was applied to hashcat to be dehashed with result of hashcat outputting the hash as a solution.

Crappy solution

Use large amounts of HDD space.

Use python to output a second word list of hashes

Googled: https://asecuritysite.com/hash/ssid_hm?v...al2=oxtailweb

File1 hashes
File2 hashes + original word

Run each hash through your decryption program

Once found/assuming it's found

Grep that hash into File2 to find original word

Hashcat had rules for dictionary variations but that's only if you don't have hits in the hash list.

A hashcat custom module would have worked too (for me) if I could remember how to code in C. If your decryption algorithm is in C that could be much faster, cleaner solution that could maybe work...

I had a similar problem.
Reply