Updated XOR to include Cascade scheme

This commit is contained in:
George J 2018-08-24 22:33:24 +01:00
parent 5aa13f2428
commit 70d4e3394c
2 changed files with 3 additions and 2 deletions

View file

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