I wrote a program that attempts to brute-force sha1 hashes. It's multi-
threaded and currently scales to 24 CPUs. I use crypto++ for the hash
generation.
My program takes a sha1 hash as the sole argument and then begins
generating strings and computing hashes for those strings and
comparing them to the user entered hash.
Anyway, long story short, the hash generation in crypto++ seems slow
to me. It's probably the way in which I'm doing it. Here's the
function that generates hashes and then compares. When I comment out
just the hash generation section, the program goes through 82 million
strings in a few seconds, when I uncomment it, it takes about 4
minutes:
void search(std::string& generated_string)
{
// crypto++
std::string digest;
CryptoPP::SHA1 thash;
CryptoPP::StringSource foo(generated_string, true,
new CryptoPP::HashFilter(thash,
new CryptoPP::HexEncoder(
new CryptoPP::StringSink(digest), false))); // The last false
makes
the hash lowercase.
if (digest == password_hash)
{
boost::posix_time::ptime end =
boost::posix_time::microsec_clock::local_time();
boost::posix_time::time_duration timed = end - begin;
std::cout << "PASSWORD:\t" << generated_string << std::endl;
std::cout << "H:M:S.ms:\t" << timed << std::endl;
found = true;
}
}
I can provide more info if anyone is interested. Thanks for any
advice. First time crypto++ user and it's a great library!
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.