Yes, I do plan to use other hashes, that's one reason I like Crypto++
I fixed it. It was the hex encoding that was making it so slow. I used
the hex function from smallsha1 (editing it to do any hash). Here are
the results:
b...@amd64:~/rbt_working/programs/cpp/password_crack$ ./16crack
9233b6f5388d6867a2a7be14d8b4ba53c86cfde2
PASSWORD: "brad"
ATTEMPTS: 45379837
H:M:S.ms: 00:00:27.457115
It's just as fast as smallsha1 one now, with any Crypto++ hash. Here
is the Crypto++ code:
// Crypto++
------------------------------------------------------------------------------
CryptoPP::SHA1 hash;
byte digest[ hash.DIGESTSIZE ];
// To do standard hashes, use this
hash.CalculateDigest( digest, (const byte*)generated_string.c_str(),
generated_string.length() );
// End Crypto++
------------------------------------------------------------------------------
char hexstring2[(hash.DIGESTSIZE*2)+1];
hex_string(digest, hexstring2, hash.DIGESTSIZE);
And here is the very slightly modified smallsha1 hexencoder:
// From smallsha1 code... Convert to hex string... this is very fast.
void inline hex_string(const unsigned char *hash, char *hexstring, int
hash_size)
{
const char tab[]={"0123456789abcdef"};
for(int i=hash_size;--i>=0;) //
hash_size was hard coded at 20
{
hexstring[i<<1]=tab[(hash[i]>>4)&0xF];
hexstring[(i<<1)+1]=tab[hash[i]&0xF];
}
hexstring[hash_size*2]=0;
// hash_size*2 was hard coded at 40
}
I'm fixed for now. Thanks for the tips.
Brad
--
You received this message because you are subscribed to the "Crypto++ Users"
Google Group.
To unsubscribe, send an email to [email protected].
More information about Crypto++ and this group is available at
http://www.cryptopp.com.