Advertisement
7a_

Iterated salted hash function example in PHP

7a_
Jun 26th, 2012
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. /*
  2.    Created By Abraham Aranguren <name.surname@gmail.com> Twitter: @7a_ http://7-a.org
  3.    Iterates a salted hash function for secure password storage
  4.    Please see this link for more info: http://owasp.com/index.php/Password_Storage_Cheat_Sheet
  5. */
  6. function GetHash($Password, $SystemSalt, $UserSalt) {
  7.     $Hash = $Password
  8.     foreach (range(0, 1000000) as $i) {
  9.         $Hash = sha512($Hash + $SystemSalt + $UserSalt + $i)
  10.     }
  11.     return $Hash
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement