使用sha1加密4:raravel 4中的逐步指南
Implement the make(), check(), and needsRehash() methods as follows:
class SHAHasher implements Illuminate\Hashing\HasherInterface { 公共功能制造($ value){ 返回哈希('sha1',$ value); } 公共功能检查($ value,$ hashedvalue){ 返回$ this-> make($ value)=== $ hashedvalue; } 公共功能需要刻痕($ hashedvalue){ 返回false; } }
注册SHA1 HASHER一旦创建了Shahasher类,我们需要将其注册为Laravel Service容器为默认的Hasher。 directory.
Register the SHAHasher class using the following code:class SHAHasher implements Illuminate\Hashing\HasherInterface {
public function make($value) {
return hash('sha1', $value);
}
public function check($value, $hashedValue) {
return $this->make($value) === $hashedValue;
}
public function needsRehash($hashedValue) {
return false;
}
}
In app/config/app.php, remove the following line from the providers array:
'SHAHashServiceProvider',免责声明: 提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发到邮箱:[email protected] 我们会第一时间内为您处理。
Copyright© 2022 湘ICP备2022001581号-3