使用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