This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// secure hashing of passwords using bcrypt, needs PHP 5.3+ | |
// see http://codahale.com/how-to-safely-store-a-password/ | |
// salt for bcrypt needs to be 22 base64 characters (but just [./0-9A-Za-z]), see http://php.net/crypt | |
// just an example; please use something more secure/random than sha1(microtime) :) | |
$salt = substr(str_replace('+', '.', base64_encode(sha1(microtime(true), true))), 0, 22); | |
// 2a is the bcrypt algorithm selector, see http://php.net/crypt |