php sha256
echo hash('sha256', $_POST['ppasscode']);
4.17
6
$password = 'test123';
/*
Always use salt for security reasons.
I'm using the BCRYPT algorithm use any valid one you like.
*/
$options['salt'] = 'usesomesillystringforsalt';
$options['cost'] = 3;
echo password_hash($password, PASSWORD_BCRYPT, $options)
Thank you!
6
0
0
0
Could this be a typo? (two Ps in ppasscode, intended?)
$_POST['ppasscode'];
I would make sure and do:
print_r($_POST);
and make sure the data is accurate there, and then echo out what it should look like:
echo hash('sha256', $_POST['ppasscode']);
Compare this output to what you have in the database (manually). By doing this you're exploring your possible points of failure:
Getting password from form
hashing the password
stored password
comparison of the two.
Thank you!
0
0
4
6
hash($hashingMethod, $dataToBeHashed, $BinaryOutputMode = false)
some hashingMethod options:
md5
sha1
sha256
sha384
sha512
Thank you!
6
0
4.25
4
$hash = hash('sha256', 'hello, world!');
var_dump($hash);
Thank you!
4
0
3.67
3
<?php
echo hash('ripemd160', 'The quick brown fox jumped over the lazy dog.');
?>
Thank you!
3
0
Are there any code examples left?
New code examples in category PHP