mirror of
https://github.com/gchq/CyberChef
synced 2024-12-28 21:43:21 +00:00
Tidied up Rabbit operations
This commit is contained in:
parent
1cc8b150f3
commit
7403666a11
4 changed files with 32 additions and 32 deletions
|
@ -75,7 +75,6 @@
|
|||
"AES Decrypt",
|
||||
"Blowfish Encrypt",
|
||||
"Blowfish Decrypt",
|
||||
"ChaCha",
|
||||
"DES Encrypt",
|
||||
"DES Decrypt",
|
||||
"Triple DES Encrypt",
|
||||
|
@ -86,6 +85,8 @@
|
|||
"RC2 Decrypt",
|
||||
"RC4",
|
||||
"RC4 Drop",
|
||||
"ChaCha",
|
||||
"Rabbit",
|
||||
"SM4 Encrypt",
|
||||
"SM4 Decrypt",
|
||||
"ROT13",
|
||||
|
@ -134,8 +135,7 @@
|
|||
"Typex",
|
||||
"Lorenz",
|
||||
"Colossus",
|
||||
"SIGABA",
|
||||
"Rabbit Stream Cipher"
|
||||
"SIGABA"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -10,19 +10,19 @@ import { toHexFast } from "../lib/Hex.mjs";
|
|||
import OperationError from "../errors/OperationError.mjs";
|
||||
|
||||
/**
|
||||
* Rabbit Stream Cipher operation
|
||||
* Rabbit operation
|
||||
*/
|
||||
class RabbitStreamCipher extends Operation {
|
||||
class Rabbit extends Operation {
|
||||
|
||||
/**
|
||||
* RabbitStreamCipher constructor
|
||||
* Rabbit constructor
|
||||
*/
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.name = "Rabbit Stream Cipher";
|
||||
this.name = "Rabbit";
|
||||
this.module = "Ciphers";
|
||||
this.description = "Rabbit Stream Cipher, a stream cipher algorithm defined in RFC4503.<br><br>The cipher uses a 128-bit key and an optional 64-bit initialization vector (IV).<br><br>big-endian: based on RFC4503 and RFC3447<br>little-endian: compatible with Crypto++";
|
||||
this.description = "Rabbit is a high-speed stream cipher introduced in 2003 and defined in RFC 4503.<br><br>The cipher uses a 128-bit key and an optional 64-bit initialization vector (IV).<br><br>big-endian: based on RFC4503 and RFC3447<br>little-endian: compatible with Crypto++";
|
||||
this.infoURL = "https://wikipedia.org/wiki/Rabbit_(cipher)";
|
||||
this.inputType = "string";
|
||||
this.outputType = "string";
|
||||
|
@ -244,4 +244,4 @@ class RabbitStreamCipher extends Operation {
|
|||
|
||||
}
|
||||
|
||||
export default RabbitStreamCipher;
|
||||
export default Rabbit;
|
|
@ -129,7 +129,7 @@ import "./tests/Shuffle.mjs";
|
|||
import "./tests/FletcherChecksum.mjs";
|
||||
import "./tests/CMAC.mjs";
|
||||
import "./tests/AESKeyWrap.mjs";
|
||||
import "./tests/RabbitStreamCipher.mjs";
|
||||
import "./tests/Rabbit.mjs";
|
||||
|
||||
// Cannot test operations that use the File type yet
|
||||
// import "./tests/SplitColourChannels.mjs";
|
||||
|
|
|
@ -8,12 +8,12 @@ import TestRegister from "../../lib/TestRegister.mjs";
|
|||
|
||||
TestRegister.addTests([
|
||||
{
|
||||
name: "Rabbit Stream Cipher: RFC Test vector, without IV 1",
|
||||
name: "Rabbit: RFC Test vector, without IV 1",
|
||||
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
expectedOutput: "b15754f036a5d6ecf56b45261c4af70288e8d815c59c0c397b696c4789c68aa7f416a1c3700cd451da68d1881673d696",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": ""},
|
||||
|
@ -23,12 +23,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: RFC Test vector, without IV 2",
|
||||
name: "Rabbit: RFC Test vector, without IV 2",
|
||||
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
expectedOutput: "3d2df3c83ef627a1e97fc38487e2519cf576cd61f4405b8896bf53aa8554fc19e5547473fbdb43508ae53b20204d4c5e",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "912813292e3d36fe3bfc62f1dc51c3ac"},
|
||||
{"option": "Hex", "string": ""},
|
||||
|
@ -38,12 +38,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: RFC Test vector, without IV 3",
|
||||
name: "Rabbit: RFC Test vector, without IV 3",
|
||||
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
expectedOutput: "0cb10dcda041cdac32eb5cfd02d0609b95fc9fca0f17015a7b7092114cff3ead9649e5de8bfc7f3f924147ad3a947428",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "8395741587e0c733e9e9ab01c09b0043"},
|
||||
{"option": "Hex", "string": ""},
|
||||
|
@ -53,12 +53,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: RFC Test vector, with IV 1",
|
||||
name: "Rabbit: RFC Test vector, with IV 1",
|
||||
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
expectedOutput: "c6a7275ef85495d87ccd5d376705b7ed5f29a6ac04f5efd47b8f293270dc4a8d2ade822b29de6c1ee52bdb8a47bf8f66",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": "0000000000000000"},
|
||||
|
@ -68,12 +68,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: RFC Test vector, with IV 2",
|
||||
name: "Rabbit: RFC Test vector, with IV 2",
|
||||
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
expectedOutput: "1fcd4eb9580012e2e0dccc9222017d6da75f4e10d12125017b2499ffed936f2eebc112c393e738392356bdd012029ba7",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": "c373f575c1267e59"},
|
||||
|
@ -83,12 +83,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: RFC Test vector, with IV 3",
|
||||
name: "Rabbit: RFC Test vector, with IV 3",
|
||||
input: "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||
expectedOutput: "445ad8c805858dbf70b6af23a151104d96c8f27947f42c5baeae67c6acc35b039fcbfc895fa71c17313df034f01551cb",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": "a6eb561ad2f41727"},
|
||||
|
@ -98,12 +98,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: generated stream should be XORed with the input",
|
||||
name: "Rabbit: generated stream should be XORed with the input",
|
||||
input: "cedda96c054e3ddd93da7ed05e2a4b7bdb0c00fe214f03502e2708b2c2bfc77aa2311b0b9af8aa78d119f92b26db0a6b",
|
||||
expectedOutput: "7f8afd9c33ebeb3166b13bf64260bc7953e4d8ebe4d30f69554e64f54b794ddd5627bac8eaf47e290b7128a330a8dcfd",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": ""},
|
||||
|
@ -113,12 +113,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: least significant bits should be used for the last block",
|
||||
name: "Rabbit: least significant bits should be used for the last block",
|
||||
input: "0000000000000000",
|
||||
expectedOutput: "f56b45261c4af702",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": ""},
|
||||
|
@ -128,12 +128,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: invalid key length",
|
||||
name: "Rabbit: invalid key length",
|
||||
input: "",
|
||||
expectedOutput: "Invalid key length: 8 bytes (expected: 16)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "0000000000000000"},
|
||||
{"option": "Hex", "string": ""},
|
||||
|
@ -143,12 +143,12 @@ TestRegister.addTests([
|
|||
]
|
||||
},
|
||||
{
|
||||
name: "Rabbit Stream Cipher: invalid IV length",
|
||||
name: "Rabbit: invalid IV length",
|
||||
input: "",
|
||||
expectedOutput: "Invalid IV length: 4 bytes (expected: 0 or 8)",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "00000000000000000000000000000000"},
|
||||
{"option": "Hex", "string": "00000000"},
|
||||
|
@ -160,12 +160,12 @@ TestRegister.addTests([
|
|||
{
|
||||
// this testcase is taken from the first example on Crypto++ Wiki
|
||||
// https://www.cryptopp.com/wiki/Rabbit
|
||||
name: "Rabbit Stream Cipher: little-endian mode (Crypto++ compatible)",
|
||||
name: "Rabbit: little-endian mode (Crypto++ compatible)",
|
||||
input: "Rabbit stream cipher test",
|
||||
expectedOutput: "1ae2d4edcf9b6063b00fd6fda0b223aded157e77031cf0440b",
|
||||
recipeConfig: [
|
||||
{
|
||||
"op": "Rabbit Stream Cipher",
|
||||
"op": "Rabbit",
|
||||
"args": [
|
||||
{"option": "Hex", "string": "23c2731e8b5469fd8dabb5bc592a0f3a"},
|
||||
{"option": "Hex", "string": "712906405ef03201"},
|
Loading…
Reference in a new issue