Here is an example from the PHP man page for crypt () :
<?php $password = crypt('mypassword');
Why does it work? I accept this 'mypassword' - this is the password that I want to use for the actual administrator. So I first glued and set it to $password . Obviously, I have to store this in the database. But in the following lines it uses both salt and what I'm comparing with, and I donβt understand how crypt($user_input, $password) can be equal to $password , if in this last case I ideally have the correct password as $user_input , but salty with $password compared with $password . It would be more useful for me if the last line were
if (crypt($user_input) == $password) { echo "Password verified!"; }
What? I do not understand?
php crypt
sepiroth
source share