How to use the utility.md5 function in utility

To help you get started, we’ve selected a few utility examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github highsea / hi-cms / routes / function.js View on Github external
function passwordMD5(str, key){
    // shaObj 对象存有多种SHA加密值: SHA-512  SHA-1  SHA-224, SHA-256, SHA-384 
    var strMd5 = utility.md5(str);
    //console.log('strMd5:'+strMd5);
    var shaObj = new jsSHA(strMd5, 'TEXT');
    //console.log("SHA-1 : "+shaObj.getHash('SHA-1', 'HEX'));

    return '' === str ? '' : utility.md5(shaObj.getHash('SHA-1', 'HEX') + key);
}
github qiushi123 / xiaochengxu_demos / 014云开发实现小程序支付 / cloud / pay / node_modules / digest-header / index.js View on Github external
//  HA2 = MD5( "GET:/dir/index.html" )
    //      = 39aff3a2bab6126f332b942af96d3366
    //
    //  Response = MD5( "939e7578ed9e3c518a452acee763bce9:\
    //                   dcd98b7102dd2f0e8b11d0f600bfb0c093:\
    //                   00000001:0a4f113b:auth:\
    //                   39aff3a2bab6126f332b942af96d3366" )
    //           = 6629fae49393a05397450978507c4ef1
    userpass = userpass.split(':');

    var nc = String(++NC);
    nc = NC_PAD.substring(nc.length) + nc;
    var cnonce = crypto.randomBytes(8).toString('hex');

    var ha1 = utility.md5(userpass[0] + ':' + opts.realm + ':' + userpass[1]);
    var ha2 = utility.md5(method.toUpperCase() + ':' + uri);
    var s = ha1 + ':' + opts.nonce;
    if (qop) {
        qop = qop.split(',')[0];
        s += ':' + nc + ':' + cnonce + ':' + qop;
    }
    s += ':' + ha2;
    var response = utility.md5(s);
    var authstring = 'Digest username="' + userpass[0] + '", realm="' + opts.realm
        + '", nonce="' + opts.nonce + '", uri="' + uri
        + '", response="' + response + '"';
    if (opts.opaque) {
        authstring += ', opaque="' + opts.opaque + '"';
    }
    if (qop) {
        authstring += ', qop=' + qop + ', nc=' + nc + ', cnonce="' + cnonce + '"';
    }
github xiugangzhang / video.github.io / controllers / user.js View on Github external
if (pwd1 !== pwd) {
            return res.json({
                code: 0,
                msg: 'error'
            });
        }

    }
    // console.log('密码校验结束', pwd, pwd1, pwd2, pwd3);
    // 为了实现修改密码和会员中心修改的同步性,使用这个变量用来区分会员中心和修改密码这两个模块的信息修改
    if (pwd3) {
        // console.log('我是要开始修改密码了');
        // 开始修改密码
        pwd2 = utility.md5(pwd2);
        // 对密码进行再次加密
        pwd = utility.md5(pwd2 + req.app.locals.config.secretKey);
    }

    let user = new User({
        id,
        uname,
        pwd,
        email,
        phone,
        info,
        face
    });


    // console.log(user, req.session.user.id);
    user.update(function (err, result) {
        // console.log(result);
github lzyzsd / androidcn.org / models / user.js View on Github external
UserSchema.virtual('avatar_url').get(function () {
  var url = this.avatar || ('//gravatar.com/avatar/' + utility.md5(this.email.toLowerCase()) + '?size=48');

  // www.gravatar.com 被墙
  url = url.replace('//www.gravatar.com', '//gravatar.com');

  // 让协议自适应 protocol
  if (url.indexOf('http:') === 0) {
    url = url.slice(5);
  }

  // 如果是 github 的头像,则限制大小
  if (url.indexOf('githubusercontent') !== -1) {
    url += '&s=120';
  }
  return url;
});
github luoyjx / gaoqi-blog / controllers / sign.js View on Github external
exports.activeUser = async (req, res, next) => {
  // 邮箱中的激活链接参数
  const key = req.query.key
  const name = req.query.name

  const user = await User.getUserByLoginName(name)

  if (!user) return next(new Error('[ACTIVE_USER] 未能找到用户:' + name))

  const passhash = user.pwd
  if (
    !user ||
    utility.md5(user.email + passhash + config.session_secret) !== key
  ) {
    return res.wrapRender('notify/notify', {
      error: '信息有误,账号无法激活',
      title: '通知'
    })
  }

  if (user.is_active) {
    return res.wrapRender('notify/notify', {
      error: '账号已经是激活状态',
      title: '通知'
    })
  }

  try {
    user.is_active = true
github poetries / boss / server / user.js View on Github external
const md5Pwd = (pwd) =>{
    const salt = 'imooc_is_good_3957x8yza6!@#IUHJh~~';
    console.log(utils.md5(utils.md5(pwd+salt)))
	return utils.md5(utils.md5(pwd+salt))
}
github alibaba / node-hbase-client / lib / util / bytes.js View on Github external
exports.mapKey = function (bytes) {
  return utility.md5(bytes);
};
github NZMia / NZMia.github.io / server / api / me.js View on Github external
function setEncryption(pwd) {
	const salt = 'wanying@zhang_is_good!&&+16zwyj0203#~~~';
	return encryption.md5(encryption.md5(pwd+salt));
}
github wujiabk / zhaopinApp / server / userRoute.js View on Github external
function md5(c){
    const str = 'BFT_ZhaoPin@app_DB';
    c = utility.md5(utility.md5(str+c));
    return c;
}
github bs32g1038 / node-blog / common / store_file.js View on Github external
uploadSingle(req, res, function(err) {
        if (err) {
            return callback(err)
        }
        var filename = req.file.originalname;
        var key = utility.md5(filename + String((new Date()).getTime())) + path.extname(filename);
        qnClient.upload(req.file.buffer, {
            key: key
        }, function(err, result) {
            callback(err, result.url);
        });
    })
}