Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix encryption with blocksize 4 #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chris-morgan
Copy link

The spec says:

For 4 bit numbers, the processing is a little more interesting. Each word of the tmp array is used to control permutations as in the 2-bit
and 3-bit cases. Each temporary variable is used in 4-bit chunks from the low-order end. 8 cycles are necessary to use up each variable. A cycle adds a 4-bit chunk into s0, then applies PERM1. Then the next 4-bit chunk is xored into s0, and PERM2 is applied.

That is, add then xor. This implementation had it back to front, perhaps an error derived from 2–3 which do use xor then add.

The spec says:

> For 4 bit numbers, the processing is a little more interesting.  Each
> word of the tmp array is used to control permutations as in the 2-bit
> and 3-bit cases.  Each temporary variable is used in 4-bit chunks from
> the low-order end.  8 cycles are necessary to use up each variable.  A
> cycle adds a 4-bit chunk into s0, then applies PERM1.  Then the next
> 4-bit chunk is xored into s0, and PERM2 is applied.

That is, add then xor. This implementation had it back to front,
perhaps an error derived from 2–3 which *do* use xor then add.
@chris-morgan
Copy link
Author

Aside: anyone got the official test vectors? http://richard.schroeppel.name:8015/hpc/test-index.html links to a dead FTP site, and I haven’t been able to find any other source. Such tests would help confirm an absence of errors like this.

@github-staff github-staff deleted a comment Apr 26, 2024
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