Take the 2-minute tour ×
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It's 100% free, no registration required.

For example, if the entropy of a password is 30 bits, what is the entropy of the password when you hash it with MD5?

share|improve this question
3  
On the practical side, please do not use MD5 to hash passwords, but a hashing function that is designed for passwords. –  Hendrik Brummermann Oct 12 '12 at 21:04

1 Answer 1

up vote 3 down vote accepted

Still 30 bits.

A hash function does not add entropy. It could change the entropy rate though. For example if you had 30 bits of entropy in a 64 bit password and hashed it to a 128 bit digest, the rate has gone down ($\frac{30}{64}\approx 0.47$, but $\frac{30}{128}\approx 0.23$). On the other hand, if the password is 500 bits, the entropy rate goes up.

One way to see this would be to look at all the possible values that the password could be. That would be $2^{30}$ since any other character (or bits) are assumed to be known to the attacker (otherwise they would add entropy, right?). Those $2^{30}$ values would be fed into the hash function and result in $2^{30}$ different digests. So there are the same number of passwords as digests. No added entropy.

share|improve this answer
3  
Actually, because of the possibility of collisions, the hashing might slightly reducing the entropy. –  Paŭlo Ebermann Oct 12 '12 at 19:45
    
@PaŭloEbermann, good point. Hard to quantify though, right? –  mikeazo Oct 13 '12 at 1:32
2  
@mikeazo You can calculate that using the number of output states(2^128) and the poisson distribution. The effect is negligible unless the input entropy approaches the output size. –  CodesInChaos Oct 13 '12 at 8:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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