hmac
v1.0.1
Published
pure js hmac that can be used with any create hash function.
Downloads
1,718
Readme
hmac
pure js hmac that can be used with any create hash function.
example
var Blake2s = require('blake2s')
function createBlake2s () {
return new Blake2s()
}
var createHmac = require('hmac')
.bind(null, createBlake2s, 64)
var hmac = createHmac('key 123')
var mac = hmac.update('foo', 'utf8').digest('hex')
tested with sha family algorithms against node's crypto lib, and produces correct hashes.
api: createHmac(createHash, len, key)
where createHash
is a function that returns {update(), digest()}
object
and len is either 128 or 64 (sha1, sha224, sha256 use 64,
and sha384, sha512 use 128)
key
is the key (secret) to the hmac.
see also crypto.createHmac()
License
MIT