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

Rescue pre-lightest matrix #9

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

Conversation

Al-Kindi-0
Copy link
Owner

This is an implementation with our more optimized MDS matrix.

feat: impl. a lighter MDS

feat: impl. a lighter MDS

feat: impl. a lighter MDS

feat: impl. a lighter MDS
@Al-Kindi-0 Al-Kindi-0 requested a review from bobbinth July 11, 2022 20:29
Copy link
Collaborator

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Just a few small comments inline.

crypto/src/hash/rescue/rp64_256/mod.rs Outdated Show resolved Hide resolved
crypto/src/hash/rescue/rp64_256/mod.rs Outdated Show resolved Hide resolved
Comment on lines 25 to 28
const MDS_FREQ_BLOCK_ONE: [i64; 3] = [64 >> 2, 32 >> 2, 64 >> 2];
const MDS_FREQ_BLOCK_TWO: [(i64, i64); 3] =
[(-(2 >> 1), 4 >> 1), (-(2 >> 1), 2 >> 1), (8 >> 1, 16 >> 1)];
const MDS_FREQ_BLOCK_THREE: [i64; 3] = [-(32 >> 2), 4 >> 2, 4 >> 2];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to express these as shifts (e.g. 64 >> 2) rather than just final values (e.g., 16).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is done in order to emphasize that the original constants of the matrix are shifted in order to optimize/remove some later shifts in the iFFT2 and iFFT4. Basically it is for illustration purposes but if it is ugly we can remove it and make do with a written explanation.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd probably put the final values in the code, and address the above point in the comments.

feat: impl. a lighter MDS

feat: impl. a lighter MDS

feat: impl. a lighter MDS

feat: impl. a lighter MDS
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.

2 participants