bcrypt - PHP < 5.5: password_hash compatible crypt hashing -


ok. i've big research, haven't got crypting / hashing knowledge. on own machine i've got php 5.5 , i'm using password_hash function. realized, online hosting has maximum of php 5.4.

i've got special class encrypting, that's why there (hopefully) not many changes done. here simple code:

class enigma {     public static function hash($password) {         return password_hash($password, password_default);     }     public static function verify($password, $hash) {         if (password_verify($password, $hash)) return true;         return false;     } } 

as can see simple overlay, there first occasion use it. how can replace password_hash , password_verify function crypt function compatible in future passrowd_ functions?

for example. crypt(), store result in users database, , in future when switch password_hash , password_verify functions, want crypted password work, , not forcing every user change password.

i hope during research haven't missed anything. i'm looking simple, elegant, safe solution :).

thx help, br

update: have read (http://pl1.php.net/manual/en/function.password-hash.php):

password_hash() creates new password hash using strong one-way hashing algorithm. password_hash() compatible crypt(). therefore, password hashes created crypt() can used password_hash().

but crypt has got many options, , i;m not quite sure, if of them compatible.

as per op's request:

you can use password compatibility pack if on php < 5.5

this useful when wish use php's 5.5 password_hash() function.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -