note 89748 added to function.sha1
| From: | grosbedoatgmaildotcom at osu1 dot php dot net | Date: | Sat, 21 Mar 2009 05:38:14 +0000 |
| Subject: | note 89748 added to function.sha1 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152248@lists.php.net to get a copy of this message | ||
@mVamer :
Your function is quite good and simplified, but you miss the verification procedure, to add it, just
modify this :
<?php
function obscure($password, $algorythm = "sha1")
{
// Get some random salt.
$salt = hash($algorythm, uniqid(rand(), true));
...
?>
to
<?php
function obscure($password, $salt = NULL, $algorythm = "sha1")
{
// Get some random salt, or verify a salt.
if ($salt == NULL) {
$salt = hash($algorythm, uniqid(rand(), true));
}
...
?>
Then you can verify the same way as ranko84's function.
@ranko84 : Here is a more commented version of your code, that I've done as much as I could :
http://snippets.dzone.com/posts/show/7076
----
Server IP: 89.31.146.176
Probable Submitter: 82.236.106.11
----
Manual Page -- http://www.php.net/manual/en/function.sha1.php
Edit -- https://master.php.net/note/edit/89748
Del: integrated -- https://master.php.net/note/delete/89748/integrated
Del: useless -- https://master.php.net/note/delete/89748/useless
Del: bad code -- https://master.php.net/note/delete/89748/bad+code
Del: spam -- https://master.php.net/note/delete/89748/spam
Del: non-english -- https://master.php.net/note/delete/89748/non-english
Del: in docs -- https://master.php.net/note/delete/89748/in+docs
Del: other reasons-- https://master.php.net/note/delete/89748
Reject -- https://master.php.net/note/reject/89748
Search -- https://master.php.net/manage/user-notes.php