Ask for the encryption and decryption code of nodejs Wechat

ask nodejs Wechat to encrypt the code. Wechat only provides CPP, php, Java, Python and C-sharp versions.


      // 1.Get signaturetimestampnonceechostr
      // 2.tokentimestampnonce
      let array = [config.wechat.token, ctx.query.timestamp, ctx.query.nonce]
      array.sort()
      // 3.sha1
      let resultCode = _util.hashCry(array.join(''))
exports.hashCry = str => {
  const hashCode = crypto.createHash('sha1') // 
  return hashCode.update(str, 'utf8').digest('hex')
}
Menu