From a6aa40db976e5c9532b62e2845d4e6d3d79cdc3b Mon Sep 17 00:00:00 2001 From: n1474335 Date: Fri, 8 Jul 2022 15:47:35 +0100 Subject: [PATCH] Tidied LS47 operations --- src/core/lib/LS47.mjs | 6 +++--- src/core/operations/LS47Decrypt.mjs | 5 ++--- src/core/operations/LS47Encrypt.mjs | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/core/lib/LS47.mjs b/src/core/lib/LS47.mjs index 6696aafc..ac7ca839 100644 --- a/src/core/lib/LS47.mjs +++ b/src/core/lib/LS47.mjs @@ -102,10 +102,10 @@ function checkKey(key) { counts[letters.charAt(i)] = 0; for (const elem of letters) { if (letters.indexOf(elem) === -1) - throw new OperationError("Letter " + elem + " not in LS47!"); + throw new OperationError("Letter " + elem + " not in LS47"); counts[elem]++; if (counts[elem] > 1) - throw new OperationError("Letter duplicated in the key!"); + throw new OperationError("Letter duplicated in the key"); } } @@ -120,7 +120,7 @@ function findPos (key, letter) { const index = key.indexOf(letter); if (index >= 0 && index < 49) return [Math.floor(index/7), index%7]; - throw new OperationError("Letter " + letter + " is not in the key!"); + throw new OperationError("Letter " + letter + " is not in the key"); } /** diff --git a/src/core/operations/LS47Decrypt.mjs b/src/core/operations/LS47Decrypt.mjs index cb92cd27..d5764d7f 100644 --- a/src/core/operations/LS47Decrypt.mjs +++ b/src/core/operations/LS47Decrypt.mjs @@ -20,8 +20,8 @@ class LS47Decrypt extends Operation { this.name = "LS47 Decrypt"; this.module = "Crypto"; - 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."; - this.infoURL = "https://gitea.blesmrt.net/exa/ls47/src/branch/master"; + 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.
The LS47 alphabet consists of following characters: _abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()
An LS47 key is a permutation of the alphabet that is then represented in a 7x7 grid used for the encryption or decryption."; + this.infoURL = "https://github.com/exaexa/ls47"; this.inputType = "string"; this.outputType = "string"; this.args = [ @@ -44,7 +44,6 @@ class LS47Decrypt extends Operation { * @returns {string} */ run(input, args) { - this.paddingSize = parseInt(args[1], 10); LS47.initTiles(); diff --git a/src/core/operations/LS47Encrypt.mjs b/src/core/operations/LS47Encrypt.mjs index 51283844..02f7d994 100644 --- a/src/core/operations/LS47Encrypt.mjs +++ b/src/core/operations/LS47Encrypt.mjs @@ -20,8 +20,8 @@ class LS47Encrypt extends Operation { this.name = "LS47 Encrypt"; this.module = "Crypto"; - 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."; - this.infoURL = "https://gitea.blesmrt.net/exa/ls47/src/branch/master"; + 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.
The LS47 alphabet consists of following characters: _abcdefghijklmnopqrstuvwxyz.0123456789,-+*/:?!'()
A LS47 key is a permutation of the alphabet that is then represented in a 7x7 grid used for the encryption or decryption."; + this.infoURL = "https://github.com/exaexa/ls47"; this.inputType = "string"; this.outputType = "string"; this.args = [ @@ -49,7 +49,6 @@ class LS47Encrypt extends Operation { * @returns {string} */ run(input, args) { - this.paddingSize = parseInt(args[1], 10); LS47.initTiles();