Skip to content
Advertisement

Tag: hmac

WebCrypto JS SHA256 HMAC Mismatch

I have two scripts that generate a SHA256 HMAC, with a plaintext message and Base64 encoded key. One is written in PHP and the other in JavaScript. The PHP script returns the correct HMAC, but for some reason the JS version does not. What is causing this? Here are the code samples, with a redacted (still similar in nature) key.

Advertisement