Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function better_crypt($input, $rounds = 9)
- {
- $salt = "";
- $salt_chars = array_merge(range('A','Z'), range('a','z'), range(0,9));
- for($i=0; $i < 22; $i++) {
- $salt .= $salt_chars[array_rand($salt_chars)];
- }
- return crypt($input, sprintf('$2a$%02d$', $rounds) . $salt);
- }
- $password_hash = better_crypt($input);
- $password_hash = better_crypt($db_password_hash);
- if (crypt($user_password, $password_hash) == $password_hash) {
- echo '<br>';
- echo 'true';
- }else{
- echo '<br>';
- echo 'false';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement