note 110514 added to function.crypt

From: Date: Wed, 31 Oct 2012 05:34:45 +0000
Subject: note 110514 added to function.crypt
Groups: php.notes 
Request: Send a blank email to php-notes+get-191611@lists.php.net to get a copy of this message
Along the lines of the md5crypt (5 notes down), but for blowfish <?php function blowfishCrypt($password,$cost) { $chars='./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; $salt=sprintf('$2a$%02d$',$cost); for($i=0;$i<22;$i++) $salt.=$chars[rand(0,63)]; return crypt($password,$salt); } //Example: $hash=blowfishCrypt('password',10); if(crypt('password',$hash)==$hash){ /*ok*/ } ?> ---- Server IP: 69.147.83.199 Probable Submitter: 96.50.160.237 ---- Manual Page -- http://www.php.net/manual/en/function.crypt.php Edit -- https://master.php.net/note/edit/110514 Del: integrated -- https://master.php.net/note/delete/110514/integrated Del: useless -- https://master.php.net/note/delete/110514/useless Del: bad code -- https://master.php.net/note/delete/110514/bad+code Del: spam -- https://master.php.net/note/delete/110514/spam Del: non-english -- https://master.php.net/note/delete/110514/non-english Del: in docs -- https://master.php.net/note/delete/110514/in+docs Del: other reasons-- https://master.php.net/note/delete/110514 Reject -- https://master.php.net/note/reject/110514 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#191611) next »