public function beforeSave(){
$salt = "Acrec_$";
$hashed = hash('sha512', $salt . $this->password);
$this->password = $hashed;
}
私は今、私がログインにするユーザー必要がある、ユーザーのパスワードを暗号化するために、カスタム塩とカスタムハッシュを使用して、しかしです。SHA512とカスタム塩 - PhalconPHP
PHPの使用password_hash
とpassword_verify
でloginAction();
$this->auth->check([
'email' => $this->request->getPost('email'),
'password' => $this->request->getPost('password'),
'remember' => $this->request->getPost('remember')
]);
塩は各ユーザーに固有であると考えられています。また、パスワードを保護するために単一のハッシュラウンドを使用すべきではありません。オフライン化するために複数のハッシングを使用するアルゴリズム[bcrypt](https://en.wikipedia.org/wiki/Bcrypt)を使用する必要があります実行不可能なクラッキング。 – Phylogenesis
'$ salt =" Acrec _ $ ";'あなたはそれを一重引用符で囲むべきです。 '$'はPHPの特殊文字です。 –
それは、このような文字列を返すbcryptの私が使用:[phalconセキュリティハッシュ]へ 文字列(60) "$ 2Y $ 08 $ bk5kV3BpZjlGanJDOEpPUO0CEBpTmlVAo8iCc5O4YsEk1c7004L8i" –