完善设置

This commit is contained in:
masnn committed 2020-05-22 12:15:07 +08:00
1 parent fc0d9873a2
commit 7edb29d7b8
43 files changed
+219 -184

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
const crypto = require('crypto');
global.Hydro.lib['hash.hydro'] = module.exports = {
/**
* @param {string} password
* @param {string} salt
* @param {string} hash
*/
check(password, salt, hash) {
return hash === this.hash(password, salt);
},
/**
* @param {string} password
* @param {string} salt
*/
hash(password, salt) {
const res = crypto.pbkdf2Sync(password, salt, 100000, 64, 'sha256');
return res.toString('Hex');
},
};