-
Notifications
You must be signed in to change notification settings - Fork 271
Change Sha2::Digest to make {:x} easier (hex format) #102
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
Comments
Wow, those are some wacky trait bound requirements! This seems like an unfortunate complication of |
@gjvnq do you really need something that’s generic around |
Yes, I have a function like this: fn do_backup(source: &Path, storage: &Path, alg: Digest) However, I changed to OpenSSL to get hardware acceleration. |
Overall I am not sure if it's worth to complicate use digest::Digest;
use digest::generic_array::ArrayLength;
use std::ops::Add;
fn example<D>()
where D: Digest, D::OutputSize: Add,
<D::OutputSize as Add>::Output: ArrayLength<u8>
{ .. } And personally I would use the |
Hi, I was writing a simple program and I discovered that getting a hex output of a generic hash is harder than I thought.
I expected that something like this would work:
However, the above code generates the following error:
After some experimentation, I discovered that the following code does work:
So, I think that the
Digest
trait should be changed to make the extra code unecessary.The text was updated successfully, but these errors were encountered: