Skip to content

Change Digest to make {:x #101

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

Closed
gjvnq opened this issue Feb 23, 2020 · 2 comments
Closed

Change Digest to make {:x #101

gjvnq opened this issue Feb 23, 2020 · 2 comments

Comments

@gjvnq
Copy link

gjvnq commented Feb 23, 2020

fn example<D: Digest>() {
    let mut hasher = D::new();
    hasher.input(b"hello world");
    let hash = hasher.result();
    println!("{:x}", hash);
}
fn example<D: Digest>() where <D as sha2::Digest>::OutputSize: std::ops::Add, <<D as sha2::Digest>::OutputSize as std::ops::Add>::Output: sha2::digest::generic_array::ArrayLength<u8>   {
    let mut hasher = D::new();
    hasher.input(b"hello world");
    let hash = hasher.result();
    println!("{:x}", hash);
}
@tarcieri
Copy link
Member

It sounds like you want Digest outputs to impl fmt::LowerHex?

Unfortunately right now they’re GenericArrays, so we can’t impl traits on them

@tarcieri
Copy link
Member

Dup of #102

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

No branches or pull requests

2 participants