Skip to content

Commit 8a17aba

Browse files
authored
Merge pull request #1765 from zb3/fix-ciphersaber2
2 parents df140b5 + 52709f0 commit 8a17aba

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/core/lib/CipherSaber2.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @license Apache-2.0
55
*/
66
export function encode(tempIVP, key, rounds, input) {
7-
const ivp = new Uint8Array(key.concat(tempIVP));
7+
const ivp = new Uint8Array([...key, ...tempIVP]);
88
const state = new Array(256).fill(0);
99
let j = 0, i = 0;
1010
const result = [];

tests/operations/tests/CipherSaber2.mjs

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ TestRegister.addTests([
2121
],
2222
},
2323
{
24+
// input taken from https://ciphersaber.gurus.org/
2425
name: "CipherSaber2 Decrypt",
25-
input: "\x5d\xd9\x7f\xeb\x77\x3c\x42\x9d\xfe\x9c\x3b\x21\x63\xbd\x53\x38\x18\x7c\x36\x37",
26-
expectedOutput: "helloworld",
26+
input: "\x6f\x6d\x0b\xab\xf3\xaa\x67\x19\x03\x15\x30\xed\xb6\x77" +
27+
"\xca\x74\xe0\x08\x9d\xd0\xe7\xb8\x85\x43\x56\xbb\x14\x48\xe3" +
28+
"\x7c\xdb\xef\xe7\xf3\xa8\x4f\x4f\x5f\xb3\xfd",
29+
expectedOutput: "This is a test of CipherSaber.",
2730
recipeConfig: [
2831
{
2932
op: "CipherSaber2 Decrypt",
30-
args: [{ "option": "Latin1", "string": "test" }, 20],
33+
args: [{ "option": "Latin1", "string": "asdfg" }, 1],
3134
},
3235
],
3336
},

0 commit comments

Comments
 (0)