svn: /phpdoc/en/trunk/security/ database.xml
| From: | Joey Smith | Date: | Wed, 28 Dec 2011 08:39:51 +0000 |
| Subject: | svn: /phpdoc/en/trunk/security/ database.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-9288@lists.php.net to get a copy of this message | ||
joey Wed, 28 Dec 2011 08:39:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=321459
Log:
Remove references to MD5, replace them with crypt() calls.
Changed paths:
U phpdoc/en/trunk/security/database.xml
Modified: phpdoc/en/trunk/security/database.xml
===================================================================
--- phpdoc/en/trunk/security/database.xml 2011-12-28 06:46:12 UTC (rev 321458)
+++ phpdoc/en/trunk/security/database.xml 2011-12-28 08:39:51 UTC (rev 321459)
@@ -109,9 +109,9 @@
<simpara>
In the case of truly hidden data, if its raw representation is not needed
(i.e. will not be displayed), hashing may also be taken into consideration.
- The well-known example for hashing is storing the MD5 hash of a
+ The well-known example for hashing is storing the cryptographic hash of a
password in a database, instead of the password itself. See also
- <function>crypt</function> and <function>md5</function>.
+ <function>crypt</function>.
</simpara>
<example>
<title>Using hashed password field</title>
@@ -121,12 +121,12 @@
// storing password hash
$query = sprintf("INSERT INTO users(name,pwd) VALUES('%s','%s');",
- pg_escape_string($username), md5($password));
+ pg_escape_string($username), crypt($password,
'$2a$07$usesomesillystringforsalt$'));
$result = pg_query($connection, $query);
// querying if user submitted the right password
$query = sprintf("SELECT 1 FROM users WHERE name='%s' AND pwd='%s';",
- pg_escape_string($username), md5($password));
+ pg_escape_string($username), crypt($password,
'$2a$07$usesomesillystringforsalt$'));
$result = pg_query($connection, $query);
if (pg_num_rows($result) > 0) {