note 10027 deleted from function.md5 by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 20:01:35 +0000 |
| Subject: | note 10027 deleted from function.md5 by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22164@lists.php.net to get a copy of this message | ||
I just wanted to comment on the person above who claimed that MD5 (which generates 128-bit keys) is
likely to produce repeats. There are 340282366920938463463374607431768211456 distinct 128-bit
integers. Running MD5 on a million random inputs will produce duplicates much less than
.000000000001 % of the time.
Not only this, but it is extremely difficult (some claim computationally infeasible; i don't
know if examples exist) to find two inputs which have the same MD5-checksum. And, lastly, note that
it is equally infeasible to find a string that will hash to a particular checksum.
So, use MD5. But remember that it is deterministic. In PHP, which runs concurrently, you cannot
guarantee that two scripts won't call for the system time simultaneously. You either need to
synchronize access or add a random number generator and more info like the browser's IP.