note 93676 added to function.md5
| From: | netom at elte dot hu | Date: | Tue, 22 Sep 2009 15:44:28 +0000 |
| Subject: | note 93676 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-160941@lists.php.net to get a copy of this message | ||
Salt isn't just preventig hash-value pair reuse.
Salt is for preventig rainbow table attacks. Rainbow tables are only useful for short passwords
(6-8-10 characters, or so). If you salt your passwords, you increase the length of the hashed string
dramatically, so they will not match anything in the rainbow table.
The fact, that 8 character length passwords can be bruteforced with a PC is not the fault of the MD5
algorithm. sha1, or whatever hashes can be broken in a same way (brute force). The problem is that
these hashes a "too fast". They can ben done billions of times per second.
To prevent (slow down) brute force attacks, one can construct a hash function that is very hard to
compute. This can be done easily:
<?php
$hash = $password . $salt;
for ( $i = 0; $i < 10000; $i++ ) {
$hash = md5( $hash );
}
//Store your $hash
?>
This is an implementation of the PBKDF2 function wich is described in the PKCS #5 v2 document.
----
Server IP: 92.43.200.200
Probable Submitter: 157.181.166.13
----
Manual Page -- http://www.php.net/manual/en/function.md5.php
Edit -- https://master.php.net/note/edit/93676
Del: integrated -- https://master.php.net/note/delete/93676/integrated
Del: useless -- https://master.php.net/note/delete/93676/useless
Del: bad code -- https://master.php.net/note/delete/93676/bad+code
Del: spam -- https://master.php.net/note/delete/93676/spam
Del: non-english -- https://master.php.net/note/delete/93676/non-english
Del: in docs -- https://master.php.net/note/delete/93676/in+docs
Del: other reasons-- https://master.php.net/note/delete/93676
Reject -- https://master.php.net/note/reject/93676
Search -- https://master.php.net/manage/user-notes.php