note 80986 added to function.md5

From: Date: Sun, 10 Feb 2008 06:58:58 +0000
Subject: note 80986 added to function.md5
Groups: php.notes 
Request: Send a blank email to php-notes+get-135942@lists.php.net to get a copy of this message
If you're afraid of rainbow tables (http://en.wikipedia.org/wiki/Rainbow_tables) listing your md5/sha1 password you might simply hash your password twice or more than two times (with md5 or sha1, or combining both). So save your password hashed more than once in your db to have full security. Examples: <?php $password = md5(md5($password)); $password = sha1(sha1($password)); $password = sha1(md5($password)); $password = md5(sha1($password)); ?> The following function might help to make it easier: <?php function hash_password($s,$t = 2) { for ($i = 0; $i < $t; $i++) $s = md5($s); return $s; } /* hash_password($password,2) = md5(md5($password)) hash_password($password,3) = md5(md5(md5($password))) etc ... */ ?> Actually you might just use a different hash algorithm to hash your password, instead of using md5 or sha1. Most rainbow table list md5 and sha1 passwords, so you won't have problems with a different hash function. ---- Server IP: 194.153.94.10 Probable Submitter: 80.219.227.1 ---- Manual Page -- http://www.php.net/manual/en/function.md5.php Edit -- https://master.php.net/note/edit/80986 Del: integrated -- https://master.php.net/note/delete/80986/integrated Del: useless -- https://master.php.net/note/delete/80986/useless Del: bad code -- https://master.php.net/note/delete/80986/bad+code Del: spam -- https://master.php.net/note/delete/80986/spam Del: non-english -- https://master.php.net/note/delete/80986/non-english Del: in docs -- https://master.php.net/note/delete/80986/in+docs Del: other reasons-- https://master.php.net/note/delete/80986 Reject -- https://master.php.net/note/reject/80986 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#135942) next »