note 80388 added to function.crypt

From: Date: Sun, 13 Jan 2008 21:07:00 +0000
Subject: note 80388 added to function.crypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-135076@lists.php.net to get a copy of this message
The previous poster (whatnet) is confused about having to store the (random) value used as the original salt when the password is first encrypted. This is not necessary because the output of crypt() includes the salt used to do the encryption, so the encrypted password you store in your user database is exactly what you would feed it back in later. In order to validate a password, just do what the example above suggests: <?php if (crypt($user_input, $encrypted_password) == $encrypted_password) { echo "Password verified!"; } ?> ---- Server IP: 64.71.164.2 Probable Submitter: 216.162.200.34 ---- Manual Page -- http://www.php.net/manual/en/function.crypt.php Edit -- https://master.php.net/note/edit/80388 Del: integrated -- https://master.php.net/note/delete/80388/integrated Del: useless -- https://master.php.net/note/delete/80388/useless Del: bad code -- https://master.php.net/note/delete/80388/bad+code Del: spam -- https://master.php.net/note/delete/80388/spam Del: non-english -- https://master.php.net/note/delete/80388/non-english Del: in docs -- https://master.php.net/note/delete/80388/in+docs Del: other reasons-- https://master.php.net/note/delete/80388 Reject -- https://master.php.net/note/reject/80388 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135076) next »