note 108708 added to function.crypt
| From: | Anonymous | Date: | Sat, 19 May 2012 13:06:59 +0000 |
| Subject: | note 108708 added to function.crypt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188071@lists.php.net to get a copy of this message | ||
In response to sc1n at yahoo dot com:
Your statement that crypt is "a relic of old style Unix password authentication and does weird
stuff like prepend the salt to the hash" and that "If you are looking to hash passwords so
users can login to a web interface, you probably want the function hash() function" is quite
simply incorrect.
Crypt, used properly (eg with sha256 or 512) represents probably the most secure method of hashing a
password for storing in a database or similar and subsequently using to validate user logins.
Crypt performs a multi-round hashing process on the input where as hash performs a single itteration
of the hash making it much more susceptible to brute force. Remember, hashs are often used for
validating the integrity of data, so they have to run fairly fast. Fast algorithms are much cheaper
to brute force.
For example, if hash runs in 0.001 seconds and crypt runs in 0.1 seconds, your logging in user
won't notice; however brute forcing the password hashed using crypt will take 100 times as
long.
The fact that the salt and hash method is appended to the string makes it much easier to store (1
single db field) and allows you to change the hashing method of your application in response to
security threats without having to invalidate your existing user passwords.
----
Server IP: 87.124.126.48
Probable Submitter: 78.86.153.118
----
Manual Page -- http://www.php.net/manual/en/function.crypt.php
Edit -- https://master.php.net/note/edit/108708
Del: integrated -- https://master.php.net/note/delete/108708/integrated
Del: useless -- https://master.php.net/note/delete/108708/useless
Del: bad code -- https://master.php.net/note/delete/108708/bad+code
Del: spam -- https://master.php.net/note/delete/108708/spam
Del: non-english -- https://master.php.net/note/delete/108708/non-english
Del: in docs -- https://master.php.net/note/delete/108708/in+docs
Del: other reasons-- https://master.php.net/note/delete/108708
Reject -- https://master.php.net/note/reject/108708
Search -- https://master.php.net/manage/user-notes.php