diff --git a/package-lock.json b/package-lock.json
index 6b3a5d60..cb17b30e 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -56,6 +56,7 @@
"lodash": "^4.17.21",
"loglevel": "^1.8.0",
"loglevel-message-prefix": "^3.0.0",
+ "lz-string": "^1.4.4",
"markdown-it": "^13.0.1",
"moment": "^2.29.3",
"moment-timezone": "^0.5.34",
@@ -10120,6 +10121,14 @@
"node": ">=10"
}
},
+ "node_modules/lz-string": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz",
+ "integrity": "sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==",
+ "bin": {
+ "lz-string": "bin/bin.js"
+ }
+ },
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -23564,7 +23573,7 @@
"lz-string": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz",
- "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY="
+ "integrity": "sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ=="
},
"make-dir": {
"version": "3.1.0",
diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json
index 19ab89d3..8ac60048 100644
--- a/src/core/config/Categories.json
+++ b/src/core/config/Categories.json
@@ -77,8 +77,6 @@
"Blowfish Decrypt",
"DES Encrypt",
"DES Decrypt",
- "Cetacean Cipher Encode",
- "Cetacean Cipher Decode",
"Triple DES Encrypt",
"Triple DES Decrypt",
"LS47 Encrypt",
@@ -114,6 +112,8 @@
"Atbash Cipher",
"CipherSaber2 Encrypt",
"CipherSaber2 Decrypt",
+ "Cetacean Cipher Encode",
+ "Cetacean Cipher Decode",
"Substitute",
"Derive PBKDF2 key",
"Derive EVP key",
diff --git a/src/core/operations/CetaceanCipherDecode.mjs b/src/core/operations/CetaceanCipherDecode.mjs
index a79b98c5..a50fe6b7 100644
--- a/src/core/operations/CetaceanCipherDecode.mjs
+++ b/src/core/operations/CetaceanCipherDecode.mjs
@@ -20,7 +20,7 @@ class CetaceanCipherDecode extends Operation {
this.name = "Cetacean Cipher Decode";
this.module = "Ciphers";
this.description = "Decode Cetacean Cipher input.
e.g. EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe
becomes hi
";
- this.infoURL = "";
+ this.infoURL = "https://hitchhikers.fandom.com/wiki/Dolphins";
this.inputType = "string";
this.outputType = "string";
@@ -30,7 +30,7 @@ class CetaceanCipherDecode extends Operation {
flags: "",
args: []
}
- ]
+ ];
}
/**
@@ -40,24 +40,23 @@ class CetaceanCipherDecode extends Operation {
*/
run(input, args) {
const binaryArray = [];
- for ( const char of input ) {
- if ( char === ' ' ) {
- binaryArray.push(...[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ]);
+ for (const char of input) {
+ if (char === " ") {
+ binaryArray.push(...[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]);
} else {
- binaryArray.push( char === 'e' ? 1 : 0 );
+ binaryArray.push(char === "e" ? 1 : 0);
}
}
const byteArray = [];
- for ( let i = 0; i < binaryArray.length; i += 16 ) {
- byteArray.push(binaryArray.slice(i, i + 16).join(''))
+ for (let i = 0; i < binaryArray.length; i += 16) {
+ byteArray.push(binaryArray.slice(i, i + 16).join(""));
}
- return byteArray.map( byte =>
- String.fromCharCode(parseInt( byte , 2 )
- )
- ).join('');
+ return byteArray.map(byte =>
+ String.fromCharCode(parseInt(byte, 2))
+ ).join("");
}
}
diff --git a/src/core/operations/CetaceanCipherEncode.mjs b/src/core/operations/CetaceanCipherEncode.mjs
index e32e4f81..ec5f76d6 100644
--- a/src/core/operations/CetaceanCipherEncode.mjs
+++ b/src/core/operations/CetaceanCipherEncode.mjs
@@ -5,6 +5,7 @@
*/
import Operation from "../Operation.mjs";
+import {toBinary} from "../lib/Binary.mjs";
/**
* Cetacean Cipher Encode operation
@@ -19,8 +20,8 @@ class CetaceanCipherEncode extends Operation {
this.name = "Cetacean Cipher Encode";
this.module = "Ciphers";
- this.description = "Converts any input into Cetacean Cipher.
e.g. hi
becomes EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe
\"";
- this.infoURL = "";
+ this.description = "Converts any input into Cetacean Cipher.
e.g. hi
becomes EEEEEEEEEeeEeEEEEEEEEEEEEeeEeEEe
";
+ this.infoURL = "https://hitchhikers.fandom.com/wiki/Dolphins";
this.inputType = "string";
this.outputType = "string";
}
@@ -31,23 +32,19 @@ class CetaceanCipherEncode extends Operation {
* @returns {string}
*/
run(input, args) {
- let result = [];
- let charArray = input.split('');
+ const result = [];
+ const charArray = input.split("");
- charArray.map( ( character ) => {
- if ( character === ' ' ) {
- result.push( character );
+ charArray.map(character => {
+ if (character === " ") {
+ result.push(character);
} else {
- const binaryArray = this.encodeToBinary( character ).split('');
- result.push( binaryArray.map(( str ) => str === '1' ? 'e' : 'E' ).join(''));
+ const binaryArray = toBinary(character.charCodeAt(0), "None", 16).split("");
+ result.push(binaryArray.map(str => str === "1" ? "e" : "E").join(""));
}
});
- return result.join('');
- }
-
- encodeToBinary( char, padding = 16 ) {
- return char.charCodeAt(0).toString(2).padStart( padding, '0');
+ return result.join("");
}
}