Updated XOR to include Cascade scheme
parent
5aa13f2428
commit
70d4e3394c
|
@ -25,6 +25,7 @@ export function bitOp (input, key, func, nullPreserving, scheme) {
|
|||
|
||||
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);
|
||||
|
|
|
@ -21,7 +21,7 @@ class XOR extends Operation {
|
|||
|
||||
this.name = "XOR";
|
||||
this.module = "Default";
|
||||
this.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>";
|
||||
this.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>";
|
||||
this.infoURL = "https://wikipedia.org/wiki/XOR";
|
||||
this.inputType = "byteArray";
|
||||
this.outputType = "byteArray";
|
||||
|
@ -35,7 +35,7 @@ class XOR extends Operation {
|
|||
{
|
||||
"name": "Scheme",
|
||||
"type": "option",
|
||||
"value": ["Standard", "Input differential", "Output differential"]
|
||||
"value": ["Standard", "Input differential", "Output differential", "Cascade"]
|
||||
},
|
||||
{
|
||||
"name": "Null preserving",
|
||||
|
|
Loading…
Reference in New Issue