付智勇

no message

  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 +};