A module with a better and standard API exists
Creates a HMAC hashing object that can then be fed with data repeatedly, and from which you can extract a signed hash digest whenever you want.
|The hashing algorithm to use. One of md4, md5, sha1, sha256, sha384, sha512, sha512_224, sha512_256 or ripemd160.
|string / ArrayBuffer
|A shared secret used to sign the data.
|A Hasher object.
The above script should result in the following being printed during execution: