Using bcryptwith Python 2.7, I see that the example is used bcrypt.hashpwto hash a password to store and verify that this password matches the hash, for example:
hashing
import bcrypt
password = b"somepassword"
hashed = bcrypt.hashpw(password, bcrypt.gensalt())
Ok, so far so good. This password is now hashed using bcrypt, so this is a string of hashed bytes.
Check
Now here is the part that bothers me: to verify that the plaintext password matches the hashed password, the same function is used, using the hashed password as the salt:
if bcrypt.hashpw(password, hashed) == hashed:
print("It Matches!")
else:
print("It Does not Match :(")
What's happening?
Should the results of both calls bcrypt.hashpwbe different, since the input salts are different?
, , , , . , ( ), . , .
?