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')
來自一名菜鳥的自述