samedi 29 mars 2014

Can password_hash() be replicated with crypt() in PHP 5.3.7?


Vote count:

0




A commentator in the PHP-manual on the password_hash()-function that was implemented in PHP 5.5 suggested, that the following code can actually replicate the algorithm:



<?php

$salt = mcrypt_create_iv(22, MCRYPT_DEV_URANDOM);
$salt = base64_encode($salt);
$salt = str_replace('+', '.', $salt);
$hash = crypt('rasmuslerdorf', '$2y$10$'.$salt.'$');

echo $hash;


Is this safe?



asked 38 secs ago






Aucun commentaire:

Enregistrer un commentaire