mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-15 10:36:52 -04:00
Spelling corrections.
This commit is contained in:
parent
d0954fc3ba
commit
f46d9414cf
1 changed files with 5 additions and 5 deletions
|
@ -14,7 +14,7 @@ let N = 0;
|
||||||
* @param {boolean} keyflag
|
* @param {boolean} keyflag
|
||||||
* @returns {object}
|
* @returns {object}
|
||||||
*/
|
*/
|
||||||
function genMatix(theString, keyflag=false) {
|
function genMatrix(theString, keyflag=false) {
|
||||||
const matrix = new Array(N).fill(0).map(() => new Array(N).fill(-1));
|
const matrix = new Array(N).fill(0).map(() => new Array(N).fill(-1));
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
|
@ -198,10 +198,10 @@ export function encode(plaintext, key) {
|
||||||
N = Math.ceil(Math.sqrt(key.length));
|
N = Math.ceil(Math.sqrt(key.length));
|
||||||
|
|
||||||
// Generate matrix representation of the key.
|
// Generate matrix representation of the key.
|
||||||
const keyMatrix = genMatix(key, true);
|
const keyMatrix = genMatrix(key, true);
|
||||||
|
|
||||||
// Generate matrix representation of the plaintext.
|
// Generate matrix representation of the plaintext.
|
||||||
const plaintextMatrix = genMatix(plaintext);
|
const plaintextMatrix = genMatrix(plaintext);
|
||||||
|
|
||||||
return join(multiply(keyMatrix, plaintextMatrix));
|
return join(multiply(keyMatrix, plaintextMatrix));
|
||||||
}
|
}
|
||||||
|
@ -219,10 +219,10 @@ export function decode(ciphertext, key) {
|
||||||
N = Math.ceil(Math.sqrt(key.length));
|
N = Math.ceil(Math.sqrt(key.length));
|
||||||
|
|
||||||
// Generate matrix representation of the key.
|
// Generate matrix representation of the key.
|
||||||
const keyMatrix = inverse(genMatix(key, true));
|
const keyMatrix = inverse(genMatrix(key, true));
|
||||||
|
|
||||||
// Generate matrix representation of the plaintext.
|
// Generate matrix representation of the plaintext.
|
||||||
const ciphertextMatrix = genMatix(ciphertext);
|
const ciphertextMatrix = genMatrix(ciphertext);
|
||||||
|
|
||||||
return join(multiply(keyMatrix, ciphertextMatrix));
|
return join(multiply(keyMatrix, ciphertextMatrix));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue