Here is the scenario i'm imagining, I use the python random library to generate x-bit key that I use to generate a HMAC-MD5 output. Every HMAC-MD5 has uses a different random number as its key.

My question is if I can get a large number of HMAC-MD5 output, is there anyway I can figure out the internal state being used by the random function or the module itself?


1 Answer 1


If you could do that, then you could publish a paper about how you did it in a top-tier cryptography journal!

Currently, MD5 remains unbroken against preimage attacks. Even if the underlying compression function turned out not to be a PRF, which would render moot the standard security reduction of the PRF-security of HMAC over a Merkle–Damgård hash function like MD5 to the PRF-security of the underlying compression function, it would be a remarkable feat to actually recover the key.

You have a much better bet trying to guess the state of the Python random number generator, which is probably the notoriously bad Mersenne twister. Finding how to do that is left as an exercise for the reader!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.