3 ms·
If you are using PHP then do this: $salt = '$2a$08$' . $random_data; $hash = crypt($password, $salt); $random_data is 22 random letters from A-Za-z0-9
by ars 15y ago
If you are using PHP then do this:
$salt = '$2a$08$' . $random_data;
$hash = crypt($password, $salt);
$random_data is 22 random letters from A-Za-z0-9.= (16.5 bytes)
(08 is the cost factor - you can change it, but 8 seemed reasonable in my tests.)
If you google bcrypt and php you'll find a very complex and large class for doing this. It's no longer necessary - current versions of PHP have it built in.
- brodd 15y agoMarco Arment (marco.org) has written a nice wrapper for it. https://gist.github.com/1053158 https://gist.github.com/1053158