From 2334084b51fa4b6837c3b2dbf3cb50ffe6da0d54 Mon Sep 17 00:00:00 2001 From: eeeeLeeee Date: Wed, 26 Dec 2018 19:15:36 +0800 Subject: [PATCH] sha256 + argon2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 刚刚开发环境实践了一下 由于直接Argon2字符超过64位数据库装不下,懒得去改数据库结构了,所有再套一层sha256在外面缩短下长度 --- app/Utils/Hash.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Utils/Hash.php b/app/Utils/Hash.php index dcb2062..6ee7e86 100644 --- a/app/Utils/Hash.php +++ b/app/Utils/Hash.php @@ -44,7 +44,8 @@ class Hash public static function argon2iWithSalt($pwd) { $salt = Config::get('salt'); - return password_hash($pwd.$salt, PASSWORD_ARGON2I); + return hash('sha256',password_hash($pwd.$salt, PASSWORD_ARGON2I)); + //由于直接Argon2字符超过64位数据库装不下,懒得去改数据库了,所有再套一层sha256在外面缩短下长度 } // @TODO public static function checkPassword($hashedPassword, $password)