note 89568 added to function.hash

From: Date: Sat, 14 Mar 2009 08:06:50 +0000
Subject: note 89568 added to function.hash
Groups: php.notes 
Request: Send a blank email to php-notes+get-151858@lists.php.net to get a copy of this message
@sunil I found a bug in the function, thanks for pointing it out. The function should read: <?php function doubleSalt($toHash,$username){ $password = str_split($toHash,(strlen($toHash)/2)+1); var_dump($password); $hash = hash('md5', $username.$password[0].'centerSalt'.$password[1]); return $hash; } ?> The str_split operation needs a +1 appended, otherwise the last character is cut off when the password is an odd number of characters, so that pass1 and pass2 will return the same value. ---- Server IP: 64.71.164.2 Probable Submitter: 24.255.211.58 ---- Manual Page -- http://www.php.net/manual/en/function.hash.php Edit -- https://master.php.net/note/edit/89568 Del: integrated -- https://master.php.net/note/delete/89568/integrated Del: useless -- https://master.php.net/note/delete/89568/useless Del: bad code -- https://master.php.net/note/delete/89568/bad+code Del: spam -- https://master.php.net/note/delete/89568/spam Del: non-english -- https://master.php.net/note/delete/89568/non-english Del: in docs -- https://master.php.net/note/delete/89568/in+docs Del: other reasons-- https://master.php.net/note/delete/89568 Reject -- https://master.php.net/note/reject/89568 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151858) next »