I am learning about Node js
, I don't know how to use a Cryptography
libary (SHA-1 ?). How can I use SHA-1
in Node js
. Here is pseudo code:
// Use a Base64-encoder that don't introduce line-breaks,
// or trim the output signature afterwards.
string signature = Base64.encode(SHA1.digest(stringToSign));
答案 0 :(得分:0)
Node.js为您提供加密模块。
const crypto = require('crypto');
crypto.createHash('sha1').update(stringToSign).digest('base64');