Skip to content

Commit a6aa40d

Browse files
committed
Tidied LS47 operations
1 parent 45ede4b commit a6aa40d

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/core/lib/LS47.mjs

+3-3
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,10 @@ function checkKey(key) {
102102
counts[letters.charAt(i)] = 0;
103103
for (const elem of letters) {
104104
if (letters.indexOf(elem) === -1)
105-
throw new OperationError("Letter " + elem + " not in LS47!");
105+
throw new OperationError("Letter " + elem + " not in LS47");
106106
counts[elem]++;
107107
if (counts[elem] > 1)
108-
throw new OperationError("Letter duplicated in the key!");
108+
throw new OperationError("Letter duplicated in the key");
109109
}
110110
}
111111

@@ -120,7 +120,7 @@ function findPos (key, letter) {
120120
const index = key.indexOf(letter);
121121
if (index >= 0 && index < 49)
122122
return [Math.floor(index/7), index%7];
123-
throw new OperationError("Letter " + letter + " is not in the key!");
123+
throw new OperationError("Letter " + letter + " is not in the key");
124124
}
125125

126126
/**

src/core/operations/LS47Decrypt.mjs

+2-3
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 = "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";
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.<br>The LS47 alphabet consists of following characters: <code>_abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()</code><br>An 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://github.com/exaexa/ls47";
2525
this.inputType = "string";
2626
this.outputType = "string";
2727
this.args = [
@@ -44,7 +44,6 @@ class LS47Decrypt extends Operation {
4444
* @returns {string}
4545
*/
4646
run(input, args) {
47-
4847
this.paddingSize = parseInt(args[1], 10);
4948

5049
LS47.initTiles();

src/core/operations/LS47Encrypt.mjs

+2-3
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 = "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";
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.<br>The LS47 alphabet consists of following characters: <code>_abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()</code><br>A 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://github.com/exaexa/ls47";
2525
this.inputType = "string";
2626
this.outputType = "string";
2727
this.args = [
@@ -49,7 +49,6 @@ class LS47Encrypt extends Operation {
4949
* @returns {string}
5050
*/
5151
run(input, args) {
52-
5352
this.paddingSize = parseInt(args[1], 10);
5453

5554
LS47.initTiles();

0 commit comments

Comments
 (0)