mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
migrate-hustoj: fix password check
This commit is contained in:
1 parent
11cc42b943
commit
0934f79cfc
4 files changed
+6
-6
No files matched your search
@@ -5,8 +5,8 @@ const RE_MD5 = /^[\da-f]{32}$/;
|
||||
function hash($password: string, $saved: string) {
|
||||
$password = md5($password);
|
||||
if (RE_MD5.test($saved)) return $password === $saved;
|
||||
const $svd = Buffer.from($saved, 'base64').toString();
|
||||
const $salt = $svd.substr(20);
|
||||
const $svd = Buffer.from($saved, 'base64').toString('hex');
|
||||
const $salt = Buffer.from($svd.substr(40), 'hex').toString();
|
||||
const $hash = Buffer.concat([
|
||||
Buffer.from(sha1($password + $salt), 'hex'),
|
||||
Buffer.from($salt),
|
||||
|
||||
Reference in new issue
Block a user