mirror of
https://github.com/gchq/CyberChef.git
synced 2024-11-16 00:48:31 +01:00
argument added for numbers in ROT
This commit is contained in:
parent
c9d9730726
commit
bbf19ee944
2 changed files with 16 additions and 7 deletions
|
@ -35,6 +35,11 @@ class ROT13 extends Operation {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
value: true
|
value: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Rotate Numbers",
|
||||||
|
type: "boolean",
|
||||||
|
value: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "Amount",
|
name: "Amount",
|
||||||
type: "number",
|
type: "number",
|
||||||
|
@ -51,8 +56,9 @@ class ROT13 extends Operation {
|
||||||
run(input, args) {
|
run(input, args) {
|
||||||
const output = input,
|
const output = input,
|
||||||
rot13Lowercase = args[0],
|
rot13Lowercase = args[0],
|
||||||
rot13Upperacse = args[1];
|
rot13Upperacse = args[1],
|
||||||
let amount = args[2],
|
rotNumbers = args[2];
|
||||||
|
let amount = args[3],
|
||||||
chr;
|
chr;
|
||||||
|
|
||||||
if (amount) {
|
if (amount) {
|
||||||
|
@ -68,6 +74,9 @@ class ROT13 extends Operation {
|
||||||
} else if (rot13Lowercase && chr >= 97 && chr <= 122) { // Lower case
|
} else if (rot13Lowercase && chr >= 97 && chr <= 122) { // Lower case
|
||||||
chr = (chr - 97 + amount) % 26;
|
chr = (chr - 97 + amount) % 26;
|
||||||
output[i] = chr + 97;
|
output[i] = chr + 97;
|
||||||
|
} else if (rotNumbers && chr >= 48 && chr <= 57) {
|
||||||
|
chr = (chr - 48 + amount) % 10;
|
||||||
|
output[i] = chr + 48;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -131,7 +131,7 @@ TestRegister.addTests([
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "ROT13",
|
op: "ROT13",
|
||||||
args: [true, true, 13]
|
args: [true, true, true, 13]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -142,7 +142,7 @@ TestRegister.addTests([
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "ROT13",
|
op: "ROT13",
|
||||||
args: [true, true, 13]
|
args: [true, true, true, 13]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -153,7 +153,7 @@ TestRegister.addTests([
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "ROT13",
|
op: "ROT13",
|
||||||
args: [true, true, 26]
|
args: [true, true, true, 26]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -164,7 +164,7 @@ TestRegister.addTests([
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "ROT13",
|
op: "ROT13",
|
||||||
args: [true, false, 13]
|
args: [true, false, false, 13]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
@ -175,7 +175,7 @@ TestRegister.addTests([
|
||||||
recipeConfig: [
|
recipeConfig: [
|
||||||
{
|
{
|
||||||
op: "ROT13",
|
op: "ROT13",
|
||||||
args: [false, true, 13]
|
args: [false, true, false, 13]
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue