mirror of
https://github.com/gchq/CyberChef.git
synced 2025-05-08 15:25:01 -04:00
Merge 6f53a791af
into dcc28438ff
This commit is contained in:
commit
a11cdb379f
3 changed files with 2099 additions and 2094 deletions
4182
package-lock.json
generated
4182
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -378,7 +378,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",
|
||||
|
|
|
@ -32,9 +32,9 @@ const BitwiseOp = {
|
|||
|
||||
for (let i = 0; i < input.length; i++) {
|
||||
k = key[i % key.length];
|
||||
if (scheme === "Cascade") k = input[i + 1] || 0;
|
||||
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 +45,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 +67,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