Advertisement
Guest User

Untitled

a guest
Sep 18th, 2014
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function better_crypt($input, $rounds = 9)
  2. {
  3. $salt = "";
  4. $salt_chars = array_merge(range('A','Z'), range('a','z'), range(0,9));
  5. for($i=0; $i < 22; $i++) {
  6. $salt .= $salt_chars[array_rand($salt_chars)];
  7. }
  8. return crypt($input, sprintf('$2a$%02d$', $rounds) . $salt);
  9. }
  10. $password_hash = better_crypt($input);
  11.  
  12. $password_hash = better_crypt($db_password_hash);
  13.  
  14. if (crypt($user_password, $password_hash) == $password_hash) {
  15. echo '<br>';
  16. echo 'true';
  17. }else{
  18. echo '<br>';
  19. echo 'false';
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement