我有这个哈希类,我需要从 SHA256 转换为 bcrypt,因为我用它来存储密码。 我似乎无法将文档翻译成我的情况。
<?php
class Hash{
public static function make($string, $salt = ''){
return hash('sha256', $string . $salt);
}
public static function salt($length){
return mcrypt_create_iv($length);
}
public static function unique(){
return self::make(uniqid());
}
}
最好的方法似乎是将表单中的逻辑从
password_hash(Input::get('password'),PASSWORD_DEFAULT),
自
password_hash(Input::get('password'), PASSWORD_BCRYPT, array('cost' => 12)),
我现有的password_verify从我的用户类开始工作。