Posted By

AzizLight on 09/24/09


Tagged

php random hash


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

silentbob84


Generate unique random hash


 / Published in: PHP
 

  1. $seed = 'JvKnrQWPsThuJteNQAuH';
  2. $hash = sha1(uniqid($seed . mt_rand(), true));
  3.  
  4. # To get a shorter version of the hash, just use substr
  5. $hash = substr($hash, 0, 10);

Report this snippet  

You need to login to post a comment.