2
0
mirror of https://github.com/gchq/CyberChef synced 2025-12-05 23:53:27 +00:00

Fix HMAC operation when hex key has bytes >= 0x80 (#437)

Add test vectors from RFC4231
This commit is contained in:
Oliver Grubin
2018-12-14 21:32:44 +00:00
parent 15fbe5a459
commit 63593f1b6c
2 changed files with 298 additions and 2 deletions

View File

@@ -72,7 +72,7 @@ class HMAC extends Operation {
msg = Utils.arrayBufferToStr(input, false),
hasher = CryptoApi.getHasher(hashFunc);
const mac = CryptoApi.getHmac(CryptoApi.encoder.fromUtf(key), hasher);
const mac = CryptoApi.getHmac(key, hasher);
mac.update(msg);
return CryptoApi.encoder.toHex(mac.finalize());
}