Advertisement
Guest User

Untitled

a guest
Feb 21st, 2013
1,031
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. function generateRandomString($length) {
  2. $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
  3. $randomString = '';
  4. for ($i = 0; $i < $length; $i++) {
  5. $randomString .= $characters[rand(0, strlen($characters) - 1)];
  6. }
  7. return $randomString;
  8. }
  9. $salt = generateRandomString(16);
  10. $sha = 'SHA';
  11. $hash = hash('sha256', hash('sha256', $pass1) . $salt);
  12. $encrypt = '$' . $sha . '$' . $salt . '$' . $hash;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement