mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-21 15:26:16 -04:00
fix: ROT13 - shifting numbers by negative amounts
Fixes https://github.com/gchq/CyberChef/issues/1886.
This commit is contained in:
parent
d635cca210
commit
7e5eb01a5e
2 changed files with 89 additions and 11 deletions
|
@ -135,10 +135,21 @@ TestRegister.addTests([
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: no shift amount",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, true, 0]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: normal",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt.",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt. 3456789012",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
|
@ -146,10 +157,21 @@ TestRegister.addTests([
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: negative shift amount",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "Gur Dhvpx Oebja Sbk Whzcrq Bire Gur Ynml Qbt. 7890123456",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, true, -13]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: full loop",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 6789012345",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
|
@ -157,10 +179,21 @@ TestRegister.addTests([
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: full loop (negative shift amount)",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 4567890123",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [true, true, true, -26]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: lowercase only",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "Tur Qhvpx Bebja Fbk Jhzcrq Oire Tur Lnml Dbt.",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "Tur Qhvpx Bebja Fbk Jhzcrq Oire Tur Lnml Dbt. 0123456789",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
|
@ -170,8 +203,8 @@ TestRegister.addTests([
|
|||
},
|
||||
{
|
||||
name: "ROT13: uppercase only",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog.",
|
||||
expectedOutput: "Ghe Duick Orown Sox Wumped Bver Ghe Yazy Qog.",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "Ghe Duick Orown Sox Wumped Bver Ghe Yazy Qog. 0123456789",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
|
@ -179,6 +212,50 @@ TestRegister.addTests([
|
|||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: numbers only",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 5678901234",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [false, false, true, 5]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: numbers only (negative shift amount)",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 5678901234",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [false, false, true, 5]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: numbers only loop",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [false, false, true, 10]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT13: numbers only loop (negative shift amount)",
|
||||
input: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
expectedOutput: "The Quick Brown Fox Jumped Over The Lazy Dog. 0123456789",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "ROT13",
|
||||
args: [false, false, true, -10]
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "ROT47: nothing",
|
||||
input: "",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue