-
Notifications
You must be signed in to change notification settings - Fork 270
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
implementation of md6 in pure rust #636
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can not merge this implementation in such state.
Please, do not disable the Clippy lints, follow the trait API defined in the digest
crate, keep the crate no_std
-capable (i.e. your code should not have any Vec
s), add a CI workflow config for this crate (you can use the md5
file for reference), add the crate to the workspace by modifying the root Cargo.toml file, and remove the md6/.gitignore
file.
Our trait APIs are a bit complex (and not documented that well), so I recommend taking a look at other crates in this repository first.
@newpavlov |
The CI failure is fixed in #637, so you need to rebase to master. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! I have some surface-level comments for now. I will take a closer look at the algorithm implementation later.
added source for test vectors
Could you also add this crate to the algorithms table in the root README? |
Also please add a CI job for this crate. You can use the md5 config for reference. |
while j < r * C { | ||
// Call the loop bodies based on the value of `w`. | ||
// This will perform the main computation for each step in the compression loop. | ||
call_loop_bodies!(W, s, i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You always use the W
constant with this macro. Why do you then handle other potential W
values in the macro?
You either need to change W
depending on compilation target (it's fine to support only 32 and 64 bit targets), or you need to remove the dead branches.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why I did that was because, I'd like to support compilation target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then you need to change the W
constant depending on target:
#[cfg(target_pointer_width = "64")]
pub const N: usize = 64;
#[cfg(target_pointer_width = "32")]
pub const N: usize = 32;
You can remove branches responsible for 16 and 8 bit targets since Rust compiler does not support those.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay sir.
md6/src/consts.rs
Outdated
|
||
const _: () = { | ||
if Q + K + U + V + B != N { | ||
panic!("`Q + K + U + V` must be equal to `N`"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, forgot B
, it should be "Q + K + U + V + B
" in the panic message.
implementation of md6 in pure rust.