mirror of
https://github.com/denoland/deno.git
synced 2024-12-23 15:49:44 -05:00
fix(ext/crypto): correct HMAC get key length op (#16201)
fixes #16180 `HMAC`'s `get key length` `op` uses the hash function's block size, not output size. refs https://github.com/cloudflare/workerd/issues/68#issuecomment-1271189657
This commit is contained in:
parent
e7d7585065
commit
225d516466
2 changed files with 5 additions and 5 deletions
|
@ -675,7 +675,7 @@ Deno.test(async function testDeriveKey() {
|
|||
const algorithm = derivedKey.algorithm as HmacKeyAlgorithm;
|
||||
assertEquals(algorithm.name, "HMAC");
|
||||
assertEquals(algorithm.hash.name, "SHA-256");
|
||||
assertEquals(algorithm.length, 256);
|
||||
assertEquals(algorithm.length, 512);
|
||||
});
|
||||
|
||||
Deno.test(async function testAesCbcEncryptDecrypt() {
|
||||
|
|
|
@ -393,16 +393,16 @@
|
|||
if (algorithm.length === undefined) {
|
||||
switch (algorithm.hash.name) {
|
||||
case "SHA-1":
|
||||
length = 160;
|
||||
length = 512;
|
||||
break;
|
||||
case "SHA-256":
|
||||
length = 256;
|
||||
length = 512;
|
||||
break;
|
||||
case "SHA-384":
|
||||
length = 384;
|
||||
length = 1024;
|
||||
break;
|
||||
case "SHA-512":
|
||||
length = 512;
|
||||
length = 1024;
|
||||
break;
|
||||
default:
|
||||
throw new DOMException(
|
||||
|
|
Loading…
Reference in a new issue