dalek-cryptography / ed25519-dalek

Fast and efficient ed25519 signing and verification in Rust.
BSD 3-Clause "New" or "Revised" License
683 stars 227 forks source link

The minimum code example in the doc does not compile #58

Closed PlaneB closed 5 years ago

PlaneB commented 5 years ago

extern crate rand; extern crate sha2; extern crate ed25519_dalek;

use rand::Rng; use rand::OsRng; use sha2::Sha512; use ed25519_dalek::Keypair; use ed25519_dalek::Signature;

fn main() { println!("Hello, world!"); let mut csprng: OsRng = OsRng::new().unwrap(); let keypair: Keypair = Keypair::generate::<Sha512, _>(&mut csprng); }

cargo build =>

error[E0277]: the trait bound sha2::Sha512: digest::Input is not satisfied
--> src/main.rs:15:28
15 let keypair: Keypair = Keypair::generate::<Sha512, _>(&mut csprng); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait digest::Input is not implemented for sha2::Sha512

= note: required because of the requirements on the impl of digest::digest::Digest for sha2::Sha512 = note: required by ed25519_dalek::Keypair::generate

error[E0277]: the trait bound sha2::Sha512: digest::BlockInput is not satisfied --> src/main.rs:15:28 15 let keypair: Keypair = Keypair::generate::<Sha512, _>(&mut csprng); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait digest::BlockInput is not implemented for sha2::Sha512

= note: required because of the requirements on the impl of digest::digest::Digest for sha2::Sha512 = note: required by ed25519_dalek::Keypair::generate

error[E0277]: the trait bound sha2::Sha512: digest::FixedOutput is not satisfied --> src/main.rs:15:28 15 let keypair: Keypair = Keypair::generate::<Sha512, _>(&mut csprng); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait digest::FixedOutput is not implemented for sha2::Sha512

= note: required because of the requirements on the impl of digest::digest::Digest for sha2::Sha512 = note: required by ed25519_dalek::Keypair::generate

isislovecruft commented 5 years ago

It looks like you might have had a mismatch between the versions of your digest sub-dependencies between the sha2 crate and this one? You can check easily with the output of cargo tree -d.

Closing for now, but feel free to reopen or start another issue if this is not the case.

pakipaki2000 commented 5 years ago

i'm having the same issues, tried everything... all sha versions, still can't compile

tarcieri commented 5 years ago

@pakipaki2000 can you post a Cargo.lock somewhere?