Posted By

liuran on 11/04/08


Tagged

hash


Versions (?)

Get a Hashed SubDirectory


 / Published in: PHP
 

  1. /**
  2.  * get a hashed subdir.
  3.  *
  4.  * @author liuran
  5.  */
  6. function getHashedDir ()
  7. {
  8. $key_1 = rand (32768, 65535);
  9. $key_2 = microtime ();
  10. $key_3 = sha1 (time ());
  11.  
  12. $sid = md5 ($key_1 . $key_3 . $key_2);
  13. $hash_dir = substr ($sid, 0, 2) . '/' . substr ($sid, 15, 2) . '/';
  14. return $hash_dir;
  15. }

Report this snippet  

You need to login to post a comment.