mirror of
https://github.com/gchq/CyberChef.git
synced 2025-04-25 01:06:16 -04:00
Add new operation: Insert bytes
This commit is contained in:
parent
2efd075803
commit
8509af2105
4 changed files with 161 additions and 0 deletions
|
@ -130,6 +130,7 @@ import "./tests/FletcherChecksum.mjs";
|
|||
import "./tests/CMAC.mjs";
|
||||
import "./tests/AESKeyWrap.mjs";
|
||||
import "./tests/Rabbit.mjs";
|
||||
import "./tests/InsertBytes.mjs";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
// import "./tests/SplitColourChannels.mjs";
|
||||
|
|
78
tests/operations/tests/InsertBytes.mjs
Normal file
78
tests/operations/tests/InsertBytes.mjs
Normal file
|
@ -0,0 +1,78 @@
|
|||
/**
|
||||
* InsertBytes test.
|
||||
*
|
||||
* @author Didier Stevens [didier.stevens@gmail.com]
|
||||
* @copyright Crown Copyright 2022
|
||||
* @license Apache-2.0
|
||||
*/
|
||||
import TestRegister from "../../lib/TestRegister.mjs";
|
||||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Insert bytes - test 1",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "", "option": "Hex"}, 0, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 2",
|
||||
input: "This is a test",
|
||||
expectedOutput: "AThis is a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 0, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 3",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is a testA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 0, true, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 4",
|
||||
input: "This is a test",
|
||||
expectedOutput: "Ahis is a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 0, false, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 5",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is a tesA",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "41", "option": "Hex"}, 1, true, true],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Insert bytes - test 6",
|
||||
input: "This is a test",
|
||||
expectedOutput: "This is not a test",
|
||||
recipeConfig: [
|
||||
{
|
||||
op: "Insert bytes",
|
||||
args: [{"string": "not ", "option": "Latin1"}, 8, false, false],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
]);
|
Loading…
Add table
Add a link
Reference in a new issue