by Wojciech Sura

Don’t md5 passwords!

A hash is a function, which must fulfill the following two statements:

  • For any set of input data it should return a result of constant size;
  • A small change (eg. 1 bit) in source data should effect in large change in the result.

Md5 is one of the most known hash functions, which fulfill both of these statements.

The first statement implies another fact: hash function is irreversible, because many different source data may result in the same hash result. This is why md5 was once widely used to store passwords: instead of storing the password (either encrypted or not), one might have store only its hash. Then it is only needed to compare stored value with hash of what user enters – if they both match, user is authenticated.

Since hash function is irreversible, the only way to break it is to perform a brute-force attack and try all possible combinations to find a password, which hashes to specific value. So, theoretically, I can tell you all “c551cff173f6cf6ebee5d521f13aff9d” and sleep peacefully sure, that access to my data is secure?

Well… it turns out, that for the last few years brute-force techniques have evolved greatly…