I md5 hash is 32 hexa characters (16 values per char). That means 2 hexa characters (16*16=256) are for one "normal" character. By my calculating that is 16 bytes per md5 hash. Is that true?
Is this question being asked so you can determine how to store the md5 hash in a database? If so, a 32-character string is ideal.
rokec
2:19 pm on Sep 26, 2006 (gmt 0)
Yes, i know that - but can i store 146 (for example) chars long text to md5 hash?
Moosetick
3:25 pm on Sep 26, 2006 (gmt 0)
MD5 is a one way hash. You can store any length in a hash. You will always end up with a 32 character aplhanumeric string. You can not determine the original contents of that string from a hash value.
rokec
8:34 pm on Sep 27, 2006 (gmt 0)
But that means that two different strings MUST have same md5 hash.
barns101
9:05 pm on Sep 27, 2006 (gmt 0)
Yes, different strings can have the same MD5 hash.
coopster
1:42 pm on Sep 28, 2006 (gmt 0)
The term you are describing is collisions. I'm no mathematician but I do know there is something called combinatorics and if you search for the "Pigeonhole Principle" you'll find plenty of technical reading. In layman's terms, the Pigeonhole Principle says that if you have 13 pigeons but only 12 pigeonholes then at least one hole would contain at least two pigeons.
However, I think you can rest assured since, for a 16-byte hash, the odds of collision are extremely high -- 2^128