strawbrary / php-sha3

PHP extension providing the sha3() hashing function
MIT License
71 stars 22 forks source link

Add support for HMAC #4

Open mackwil opened 10 years ago

mackwil commented 10 years ago

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!

strawbrary commented 9 years ago

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.

pculka commented 9 years ago

+1

2072 commented 8 years ago

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/