Skip to content

Conversation

@aforsblo
Copy link

This pull request fixes an issue where an XOR operation is done in both AbstractMixer and XORMixer, causing the source from the previous iteration to get XORed with itself, setting it to zero. This in turn causes XORMixer to always return the last source verbatim.

AbstractMixer::mix() contains the following code:

if ($j % 2 == 1) {
    $stub ^= $this->mixParts1($stub, $newKey);
} else {
    $stub ^= $this->mixParts2($stub, $newKey);
}

By inlining XorMixer::mixParts1() and XorMixer::mixParts2(), we get:

if ($j % 2 == 1) {
    $stub = $stub ^ $stub ^ $newKey;
} else {
    $stub = $stub ^ $stub ^ $newKey;
}

which is equivalent to:

if ($j % 2 == 1) {
    $stub = $newKey;
} else {
    $stub = $newKey;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant