Hi all

Could someone show me an example how to use Blowfish with crypt?

$password = crypt($_POST["password"], '$2a$07$0k5ls4mbfakdl2mbk5lo9dkr$');

Looks strange as well as the output.

Member Avatar



You check to see if it's available - see example#3 in the link above.

I don't understand what you need. This is a one-way hash. The output is meant to look strange.


CRYPT_BLOWFISH - Blowfish hashing with a salt as follows: "$2a$", a two digit cost parameter, "$", and 22 digits from the alphabet "./0-9A-Za-z". Using characters outside of this range in the salt will cause crypt() to return a zero-length string. The two digit cost parameter is the base-2 logarithm of the iteration count for the underlying Blowfish-based hashing algorithmeter and must be in range 04-31, values outside this range will cause crypt() to fail.

So the Blowfish salt in the example:


07 - the 2 digit cost (04-31)
usesomesillystringfors - the 22 digits
alt$ - excess digits (don't do anything)

Yea, I know those can't be decrypted without brute forcing. But I was wondering in what format the salt should be given.

Member Avatar


I was wondering in what format the salt should be given.

Didn't I just give you the run down?

usesomesillystringfors - the 22 digits