M
M
Matvey Mamonov2015-07-08 23:13:25
PHP
Matvey Mamonov, 2015-07-08 23:13:25

Why does hash_password() generate a different value each time?

The question is rather not why (because it is clear that it is because of the salt, which is different every time), but what is the point of this?
If I write such a generated password to the database, and then I compare the user's entered value encrypted by this function with the value in the database, then they will be different, respectively, the user will never be able to enter the site.
Another thing is the use of any other function, be it sha256, sha512, or the same md5. They constantly generate the same value, so it can always be compared with the value in the base.
So how to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2015-07-08
@eucalipt

hash_password is designed for hashing, there is another method for comparing the entered data. Learn mat. part.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question