-
Notifications
You must be signed in to change notification settings - Fork 745
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
Add inherent functions to hashes #2852
Add inherent functions to hashes #2852
Conversation
f317d82
to
9dc4bd6
Compare
concept ACK 9dc4bd68d19de94bf1058234ee9b5506c65e0a49. This looks great. I think we should make I also think we should drop |
Yeah, I'm trying to do it in basic steps but it totally flies against normal dev process of patching things into an unwanted state. |
Unfortunately in Rust everything is so tightly coupled that it's hard to make significant changes without either doing unreviewable full-rewrite PRs like 2770 (which then don't even work because the language is limited..) or having unwanted states. |
On that note, I'm stumped on how we are supposed to do the |
9dc4bd6
to
bb037d4
Compare
ACK bb037d4cabbe807b65990fd7c5048b6c372df8fc except that I think we should make the two |
Currently we have a trait `Hash` that is required for `Hmac`, `Hkdf`, and other use cases. However, it is unegonomic for users who just want to do a simple hash to have to import the trait. Add inherent functions to all hash types including those created with the new wrapper type macros. This patch introduces some duplicate code but we are trying to make progress in the hashes API re-write. We can come back and de-dublicate later. Includes making `to_byte_array`,`from_byte_array`, `as_byte_array`, and `all_zeros` const where easily possible.
bb037d4
to
63b584b
Compare
63b584b
to
18b2788
Compare
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.
ACK 18b2788
Currently we have a trait
Hash
that is required forHmac
,Hkdf
, and other use cases. However, it is unegonomic for users who just want to do a simple hash to have to import the trait.Add inherent functions to all hash types including those created with the new wrapper type macros.
This patch introduces some duplicate code but we are trying to make progress in the hashes API re-write. We can come back and de-dublicate later.
Includes making
to_byte_array
,from_byte_array
,as_byte_array
, andall_zeros
const where easily possible.