How to use the utility.sha1 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 cnpm / cnpmjs.org / controllers / registry / user / common.js View on Github external
exports.ensurePasswordSalt = function (user, body) {
  if (!user.password_sha && body.password) {
    // create password_sha on server
    user.salt = crypto.randomBytes(30).toString('hex');
    user.password_sha = utility.sha1(body.password + user.salt);
  }
};
github cnpm / cnpmjs.org / bin / change_password.js View on Github external
co(function * () {
  var user = yield UserModel.find({where: {name: username}});
  var salt = user.salt;
  console.log(`user original password_sha: ${user.password_sha}`);
  var newPasswordSha = utility.sha1(newPassword + salt);
  user.password_sha = newPasswordSha;
  user = yield user.save();
  console.log(`change user password successful!! user new password_sha: ${user.password_sha}`);
  process.exit(0);
}).catch(function (e) {
  console.log(e);
github cnpm / cnpmjs.org / models / user.js View on Github external
createPasswordSha: function (password, salt) {
        return utility.sha1(password + salt);
      },
github cnpm / cnpmjs.org / proxy / user.js View on Github external
function passwordSha(password, salt) {
  return utility.sha1(password + salt);
}
github gefangshuai / ANodeBlog / lib / wxHelper.js View on Github external
checkSignature: function (signature, timestamp, nonce) {
        var oriArray = new Array();
        oriArray[0] = nonce;
        oriArray[1] = timestamp;
        oriArray[2] = global.wx.token;    //这里是你在微信开发者中心页面里填的token
        oriArray.sort();
        var original = oriArray.join('');
        var cyptoString = utility.sha1(original);
        return signature == cyptoString;
    }
};