note 106762 deleted from security.database.storage by tularis
| From: | tularis@php.net | Date: | Mon, 05 Dec 2011 18:26:25 +0000 |
| Subject: | note 106762 deleted from security.database.storage by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184913@lists.php.net to get a copy of this message | ||
Note Submitter: kapsonfire at gmx dot de
Reason: useless
----
I use following code to hash data.
Each hash is different for each user using the userid. Aswell the saltbefore makes it impossible for
the attacker to use predefined rainbow tables....
<?php
/**
* @package Global
* @subpackage Security
*/
class Password {
/**
*
* @param string $plain
* the password as plainstring
* @param int $userid
* the userid of the user
* @return string
*/
public static function hash($plain,$userid) {
$pw = 'saltbefore'.$plain.sha256(($userid*424242*pi()));
$hash = md5($pw);
return $hash;
}
}
?>