Created
May 20, 2017 18:10
-
-
Save ariankordi/0c55ba955696629221f1b0c80f971643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# gen | |
$reqpsd = 'hello'; | |
$salt = substr(strtr(base64_encode(openssl_random_pseudo_bytes(22)),'+','.'),0,22); | |
$hash = hash_pbkdf2('sha512', $reqpsd, $salt, 1000, 50).':'.$salt; | |
# /gen | |
# check | |
$passwd = 'hello'; | |
$va = explode(':',$hash); | |
if(hash_pbkdf2('sha512',$passwd,$va[1],1000,50) == $va[0]) { | |
// success | |
print 'YES'; } else { | |
// unsuccess | |
print 'I don\'t think so..'; | |
} | |
# /check |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment