This commit is contained in:
George J 2018-05-11 09:55:28 +00:00 committed by GitHub
commit a11cdb379f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2099 additions and 2094 deletions

4182
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -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",

View file

@ -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