Skip to content

Commit e258e5a

Browse files
authored
Merge pull request #1606 from joostrijneveld/fix/chacha-raw
2 parents 75a28b5 + 3b5225a commit e258e5a

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/core/operations/ChaCha.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).`);
191191
if (outputType === "Hex") {
192192
return toHex(output);
193193
} else {
194-
return Utils.arrayBufferToStr(output);
194+
return Utils.arrayBufferToStr(Uint8Array.from(output).buffer);
195195
}
196196
}
197197

tests/operations/tests/ChaCha.mjs

+19
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,25 @@ ChaCha uses a nonce of 8 or 12 bytes (64 or 96 bits).`,
5858
}
5959
],
6060
},
61+
{
62+
name: "ChaCha: RFC8439 Raw output",
63+
input: "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.",
64+
expectedOutput: "6e 2e 35 9a 25 68 f9 80 41 ba 07 28 dd 0d 69 81 e9 7e 7a ec 1d 43 60 c2 0a 27 af cc fd 9f ae 0b f9 1b 65 c5 52 47 33 ab 8f 59 3d ab cd 62 b3 57 16 39 d6 24 e6 51 52 ab 8f 53 0c 35 9f 08 61 d8 07 ca 0d bf 50 0d 6a 61 56 a3 8e 08 8a 22 b6 5e 52 bc 51 4d 16 cc f8 06 81 8c e9 1a b7 79 37 36 5a f9 0b bf 74 a3 5b e6 b4 0b 8e ed f2 78 5e 42 87 4d",
65+
recipeConfig: [
66+
{
67+
"op": "ChaCha",
68+
"args": [
69+
{"option": "Hex", "string": "00:01:02:03:04:05:06:07:08:09:0a:0b:0c:0d:0e:0f:10:11:12:13:14:15:16:17:18:19:1a:1b:1c:1d:1e:1f"},
70+
{"option": "Hex", "string": "00:00:00:00:00:00:00:4a:00:00:00:00"},
71+
1, "20", "Raw", "Raw",
72+
]
73+
},
74+
{
75+
"op": "To Hex",
76+
"args": []
77+
},
78+
],
79+
},
6180
{
6281
name: "ChaCha: draft-strombergson-chacha-test-vectors-01 TC7.1",
6382
input: "00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00",

0 commit comments

Comments
 (0)