Tidied operations to match conventions

feature-extract-files
Matt C 2017-02-08 17:29:50 +00:00
parent 2750be36da
commit a153246191
4 changed files with 26 additions and 6 deletions

View File

@ -66,9 +66,6 @@ var Categories = [
ops: [
"AES Encrypt",
"AES Decrypt",
"Affine Cipher Encode",
"Affine Cipher Decode",
"Atbash Cipher",
"Blowfish Encrypt",
"Blowfish Decrypt",
"DES Encrypt",
@ -87,6 +84,9 @@ var Categories = [
"Vigenère Decode",
"To Morse Code",
"From Morse Code",
"Affine Cipher Encode",
"Affine Cipher Decode",
"Atbash Cipher",
"Substitute",
"Derive PBKDF2 key",
"Derive EVP key",

View File

@ -1361,7 +1361,7 @@ var OperationConfig = {
]
},
"Affine Cipher Encode": {
description: "The affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using simple mathematical function (ax + b) % 26, and converted back to a letter.",
description: "The Affine cipher is a type of monoalphabetic substitution cipher, wherein each letter in an alphabet is mapped to its numeric equivalent, encrypted using simple mathematical function (ax + b) % 26, and converted back to a letter.",
run: Cipher.runAffineEnc,
highlight: true,
highlightReverse: true,
@ -1381,7 +1381,7 @@ var OperationConfig = {
]
},
"Affine Cipher Decode": {
description: "The affine cipher is a type of monoalphabetic substitution cipher. To decrypt, each letter in an alphabet is mapped to its numeric equivalent, decrypted by a mathematical function, and converted back to a letter.",
description: "The Affine cipher is a type of monoalphabetic substitution cipher. To decrypt, each letter in an alphabet is mapped to its numeric equivalent, decrypted by a mathematical function, and converted back to a letter.",
run: Cipher.runAffineDec,
highlight: true,
highlightReverse: true,
@ -1401,7 +1401,7 @@ var OperationConfig = {
]
},
"Atbash Cipher": {
description: "Atbash is a mono-alphabetic substitution cipher originally used to encode the Hebrew alphabet. It has been modified here for use with the latin alphabet.",
description: "Atbash is a mono-alphabetic substitution cipher originally used to encode the Hebrew alphabet. It has been modified here for use with the Latin alphabet.",
run: Cipher.runAtbash,
highlight: true,
highlightReverse: true,

View File

@ -927,8 +927,11 @@ var Utils = {
a[key] = b[key];
return a;
},
/**
* Actual modulo function, since % is actually the remainder function in JS
*
* @author Matt C [matt@artemisbot.pw]
* @param {number} x
* @param {number} y
@ -937,8 +940,10 @@ var Utils = {
return ((x % y) + y) % y;
},
/**
* Finds GCD of two numbers
*
* @author Matt C [matt@artemisbot.pw]
* @param {number} x
* @param {number} y
@ -950,6 +955,14 @@ var Utils = {
return Utils.gcd(y, x % y);
},
/**
* Finds modular inverse of two values
*
* @author Matt C [matt@artemisbot.pw]
* @param {number} x
* @param {number} y
*/
modInv: function(x, y) {
x %= y;
for (var i = 1; i < y; i++) {
@ -959,6 +972,7 @@ var Utils = {
}
},
/**
* A mapping of names of delimiter characters to their symbols.
* @constant

View File

@ -385,6 +385,7 @@ var Cipher = {
return encrypted.ciphertext.toString(Utils.format[args[2]]);
},
/**
* Vigenère Encode operation.
*
@ -474,6 +475,7 @@ var Cipher = {
return output;
},
/**
* @constant
* @default
@ -484,6 +486,7 @@ var Cipher = {
* @default
*/
AFFINE_B: 0,
/**
* Affine Cipher Encode operation.
*
@ -513,6 +516,7 @@ var Cipher = {
return output;
},
/**
* Affine Cipher Encode operation.
*
@ -546,6 +550,7 @@ var Cipher = {
return output;
},
/**
* Atbash Cipher Encode operation.
*
@ -558,6 +563,7 @@ var Cipher = {
return Cipher.runAffineEnc(input, [25, 25]);
},
/**
* @constant
* @default