PHP random hash trick [never collides]

I discovered a really neat way to get a random hash that is less than 0.000005% likely to ever collide with another hash. Here is the script:

<?php

$hash = md5(rand(10,10000));

?>

Simply echo the $hash and refresh the page. You will see a new hash string every time. Feel free to comment and leave suggestions.

Advertisement

About Eating Sharks
Born, etc. twitter.com/_shahz

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.