mirror of
https://github.com/gchq/CyberChef.git
synced 2025-07-04 03:42:23 -04:00
Added Cascade XOR
This commit is contained in:
parent
f7729c0fd2
commit
4ce4a8ef52
2 changed files with 7 additions and 3 deletions
|
@ -377,7 +377,7 @@ const OperationConfig = {
|
|||
},
|
||||
"XOR": {
|
||||
module: "Default",
|
||||
description: "XOR the input with the given key.<br>e.g. <code>fe023da5</code><br><br><strong>Options</strong><br><u>Null preserving:</u> If the current byte is 0x00 or the same as the key, skip it.<br><br><u>Scheme:</u><ul><li>Standard - key is unchanged after each round</li><li>Input differential - key is set to the value of the previous unprocessed byte</li><li>Output differential - key is set to the value of the previous processed byte</li></ul>",
|
||||
description: "XOR the input with the given key.<br>e.g. <code>fe023da5</code><br><br><strong>Options</strong><br><u>Null preserving:</u> If the current byte is 0x00 or the same as the key, skip it.<br><br><u>Scheme:</u><ul><li>Standard - key is unchanged after each round</li><li>Input differential - key is set to the value of the previous unprocessed byte</li><li>Output differential - key is set to the value of the previous processed byte</li><li>Cascade - key is set to the input byte shifted by one</li></ul>",
|
||||
highlight: true,
|
||||
highlightReverse: true,
|
||||
inputType: "byteArray",
|
||||
|
|
|
@ -34,7 +34,6 @@ const BitwiseOp = {
|
|||
k = key[i % key.length];
|
||||
o = input[i];
|
||||
x = nullPreserving && (o === 0 || o === k) ? o : func(o, k);
|
||||
result.push(x);
|
||||
if (scheme &&
|
||||
scheme !== "Standard" &&
|
||||
!(nullPreserving && (o === 0 || o === k))) {
|
||||
|
@ -45,8 +44,13 @@ const BitwiseOp = {
|
|||
case "Output differential":
|
||||
key[i % key.length] = o;
|
||||
break;
|
||||
case "Cascade":
|
||||
k ^= input[i + 1];
|
||||
x = nullPreserving && (o === 0 || o === k) ? o : func(o, k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
result.push(x);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -62,7 +66,7 @@ const BitwiseOp = {
|
|||
* @constant
|
||||
* @default
|
||||
*/
|
||||
XOR_SCHEME: ["Standard", "Input differential", "Output differential"],
|
||||
XOR_SCHEME: ["Standard", "Input differential", "Output differential", "Cascade"],
|
||||
/**
|
||||
* @constant
|
||||
* @default
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue