Creates an HMAC object.
Indicates the hash algorithm name. Note: MD5 and SHA1 are insecure hash algorithms.
hash key, Note: Do not write sensitive information in plaintext in the code.
import * as crypto from 'crypto';import * as buffer from 'buffer';let hmac = crypto.createHmac(crypto.Hashs.SHA256, buffer.from('****************'));console.log(hmac.sum(buffer.from('************')).toString(buffer.Encoding.Base64)); Copy
import * as crypto from 'crypto';import * as buffer from 'buffer';let hmac = crypto.createHmac(crypto.Hashs.SHA256, buffer.from('****************'));console.log(hmac.sum(buffer.from('************')).toString(buffer.Encoding.Base64));
Creates an HMAC object.