Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: PHP  |  size: 0.30 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. function encrypt($password)
  4. {
  5.         $characters = 'ABCDEFHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
  6.         $salt = '';
  7.         for ($i = 0; $i < 5; ++$i)
  8.         {
  9.         $salt .= $characters[rand(0, strlen($characters) - 1)];
  10.     }
  11.     return array (hash('sha512', $password.$salt), $salt);
  12. }
  13.  
  14. ?>