4 ms·
md5(rand())) doesn't really make much sense. It's slightly less random than just using rand().
by eli 17y ago
md5(rand())) doesn't really make much sense. It's slightly less random than just using rand().
- Jakob 17y agoThe code in the article comes from the example of this page http://www.php.net/manual/en/function.uniqid.php http://www.php.net/manual/en/function.uniqid.php which has an interesting comments section on unique ids.
- babo 17y agoBut it has a constant length and hides randomness from the observer.
- eli 17y ago"Hide randomness" ?
- babo 17y agoFrom hashes you'll recognize the fingerprint of the hash function but not the underlying data. Here is an example of random UIDs, generating a few user's in a row and it's obvious that it's random: random.sample(xrange(10000), 10) [88, 3833, 6353, 8113, 8983, 4280, 7878, 3050, 9409, 404]
- eli 17y agoSo? And if you generated random IDs with the same number of bits as a hash function they would be indistinguishable.