Add support for HMAC
mackwil opened this issue · 3 comments
Can this library receive hex or base64 as input into the hash?
Can this library perform HMAC using the SHA3 algorithm? I would like to do HMAC(key, message) with perhaps either or both parameters as hex.
These would be a few good features. Please consider adding them if it doesn't work already.
Thank you!
If you pass in a hex string or base64 encoded string it should work.
HMAC is not yet supported, but it's something I may add in the future.
+1
Note that since sha3 is not vulnerable to extension attacks one can just prepend the secret key to the message to be authenticated in order to build a secure MAC.
Unlike SHA-1 and SHA-2, Keccak does not have the length-extension weakness, hence does not need the HMAC nested construction. Instead, MAC computation can be performed by simply prepending the message with the key.
source: http://keccak.noekeon.org/