authentication – Why does hashing a password result in different hashes, each time?

Question

if I hash the same plain-text multiple times, it returns different hash strings:

$x = 'asdf';
echo wp_hash_password( $x ).'<BR>';
echo wp_hash_password( $x ).'<BR>';
echo wp_hash_password( $x ).'<BR>';
echo wp_hash_password( $x ).'<BR>';

$P$BESNH8tVe6xfVbgXhBI2KNU.2lnyOu.
$P$BlTkcLh3PSGzXtPhofPH9ZGqisxYI0.
$P$BRyTisUAXVEhXNyTQFjOErxIgzE6GN1
$P$BI17Hnqifi2CHQsPi5z/nVbEInNjl21

So, how does wp check the password that the user enters? If it’s going to hash the plaintext and check that against the stored hash, it seems the two will never match.

0
Doug Cassidy 3 weeks 2022-07-20T13:22:24-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse