nodejs参数排序及加密比较
1.参数字典序排序
名词解释:字典序排序也就是字段按照英文字母表的顺序来排列
举个栗子 token、timestamp、nonce三个参数进行字典序排序
const token = 'msm123xyld'
let str = [Token, Timestamp, Nonce].sort().join('')
2.对排序的字符串加密
1⃣️md5加密
const result = crypto.createHash('md5').update(a).digest('hex')
2⃣️sha1加密
const result = crypto.createHash('sha1').update(a).digest('hex')
来自一名菜鸟的自述