Advertisement
Guest User

Untitled

a guest
Mar 9th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. $pass = "password";
  2. $salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
  3. $cost = 10;
  4. $salt = sprintf("$2y$%02d$", $cost) . $salt;
  5. $hash = crypt($pass, $salt);
  6. echo $hash;//Result: $2y$10$XFo5biY5UvZfaRjhDraOFO26yocvwiAwidtGNIvoEezj5zitb2Xem
  7.  
  8. UPDATE `myTable` SET `hash`="$2y$10$XFo5biY5UvZfaRjhDraOFO26yocvwiAwidtGNIvoEezj5zitb2Xem" WHERE username = "myusername"
  9.  
  10. 2432792431302458466f356269593555765a6661526a684472614f464f3236796f637677694177696474474e49766f45657a6a357a6974623258656d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement