Skip to content

Commit e71794d

Browse files
committed
Tests added for LS47
1 parent 6fd9291 commit e71794d

File tree

4 files changed

+50
-4
lines changed

4 files changed

+50
-4
lines changed

src/core/operations/LS47Decrypt.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class LS47Decrypt extends Operation {
2020

2121
this.name = "LS47 Decrypt";
2222
this.module = "Crypto";
23-
this.description = "";
24-
this.infoURL = "";
23+
this.description = "This is a slight improvement of the ElsieFour cipher as described by Alan Kaminsky. We use 7x7 characters instead of original (barely fitting) 6x6, to be able to encrypt some structured information. We also describe a simple key-expansion algorithm, because remembering passwords is popular. Similar security considerations as with ElsieFour hold.\nThe LS47 alphabet consists of following characters: _abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()\nA LS47 key is a permutation of the alphabet that is then represented in a 7x7 grid used for the encryption or decryption.";
24+
this.infoURL = "https://gitea.blesmrt.net/exa/ls47/src/branch/master";
2525
this.inputType = "string";
2626
this.outputType = "string";
2727
this.args = [

src/core/operations/LS47Encrypt.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class LS47Encrypt extends Operation {
2020

2121
this.name = "LS47 Encrypt";
2222
this.module = "Crypto";
23-
this.description = "";
24-
this.infoURL = "";
23+
this.description = "This is a slight improvement of the ElsieFour cipher as described by Alan Kaminsky. We use 7x7 characters instead of original (barely fitting) 6x6, to be able to encrypt some structured information. We also describe a simple key-expansion algorithm, because remembering passwords is popular. Similar security considerations as with ElsieFour hold.\nThe LS47 alphabet consists of following characters: _abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()\nA LS47 key is a permutation of the alphabet that is then represented in a 7x7 grid used for the encryption or decryption.";
24+
this.infoURL = "https://gitea.blesmrt.net/exa/ls47/src/branch/master";
2525
this.inputType = "string";
2626
this.outputType = "string";
2727
this.args = [

tests/operations/index.mjs

+1
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import "./tests/DefangIP.mjs";
9696
import "./tests/ParseUDP.mjs";
9797
import "./tests/AvroToJSON.mjs";
9898
import "./tests/Lorenz.mjs";
99+
import "./tests/LS47.mjs";
99100

100101

101102
// Cannot test operations that use the File type yet

tests/operations/tests/LS47.mjs

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/**
2+
* Cartesian Product tests.
3+
*
4+
* @author n1073645 [[email protected]]
5+
*
6+
* @copyright Crown Copyright 2020
7+
* @license Apache-2.0
8+
*/
9+
import TestRegister from "../../lib/TestRegister.mjs";
10+
11+
TestRegister.addTests([
12+
{
13+
name: "LS47 Encrypt",
14+
input: "thequickbrownfoxjumped",
15+
expectedOutput: "(,t74ci78cp/8trx*yesu:alp1wqy",
16+
recipeConfig: [
17+
{
18+
op: "LS47 Encrypt",
19+
args: ["helloworld", 0, "test"],
20+
},
21+
],
22+
},
23+
{
24+
name: "LS47 Decrypt",
25+
input: "(,t74ci78cp/8trx*yesu:alp1wqy",
26+
expectedOutput: "thequickbrownfoxjumped---test",
27+
recipeConfig: [
28+
{
29+
op: "LS47 Decrypt",
30+
args: ["helloworld", 0],
31+
},
32+
],
33+
},
34+
{
35+
name: "LS47 Encrypt",
36+
input: "thequickbrownfoxjumped",
37+
expectedOutput: "Letter H is not included in LS47",
38+
recipeConfig: [
39+
{
40+
op: "LS47 Encrypt",
41+
args: ["Helloworld", 0, "test"],
42+
},
43+
],
44+
}
45+
]);

0 commit comments

Comments
 (0)