0

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.

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by diafol
0

http://php.net/manual/en/function.crypt.php

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.

FROM THE PHP MANUAL:

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:

$2a$07$usesomesillystringforsalt$

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

0

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

0

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

Didn't I just give you the run down?

usesomesillystringfors - the 22 digits

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.