正在显示
1 个修改的文件
包含
24 行增加
和
0 行删除
util/saltMD5.js
0 → 100644
1 | +const key="3mang"; | ||
2 | +const crypto = require('crypto'); | ||
3 | +module.exports={ | ||
4 | + md5AddSalt:function(password){ | ||
5 | + var salt=Math.floor(Math.random()*100); | ||
6 | + var decipher = crypto.createHash('md5',key); | ||
7 | + var md5Pass=decipher.update(password+""+salt).digest("hex"); | ||
8 | + return { | ||
9 | + salt:salt, | ||
10 | + md5Pass:md5Pass | ||
11 | + }; | ||
12 | + }, | ||
13 | + md5:function(password){ | ||
14 | + var md5Pass = crypto.createHash('md5').update(password).digest("hex"); | ||
15 | + return md5Pass | ||
16 | + }, | ||
17 | + md5Salt:function(password,salt){ | ||
18 | + if(salt == null){ | ||
19 | + salt = ''; | ||
20 | + } | ||
21 | + var decipher = crypto.createHash('md5',key); | ||
22 | + return decipher.update(password+salt).digest("hex"); | ||
23 | + } | ||
24 | +}; |
-
请 注册 或 登录 后发表评论