Thursday, 15 March 2012

php - What's the easiest and quickest way to check if a string is a bcrypt hash? -



php - What's the easiest and quickest way to check if a string is a bcrypt hash? -

i'm writing unit test says user passwords should hashed using bcrypt. assert need able check if string looks bcrypt hash.

i can't find function tells me hashing algorithm used on string, there way other regular expressions?

@jiml soultion bit limiting, there question breaking downwards construction of bcrypt hash.

$2a$[cost]$[base64salt][base64hash]

so depending on application can assert bcrypt identifier $2a , require costs of generated hash.

see: http://stackoverflow.com/a/10933491/1722719 total breakdown.

php hash phpunit bcrypt

No comments:

Post a Comment