dalek-cryptography / x25519-dalek

X25519 elliptic curve Diffie-Hellman key exchange in pure-Rust, using curve25519-dalek.
BSD 3-Clause "New" or "Revised" License
328 stars 133 forks source link

Sample code uses deprecated "rand_os" #59

Closed Andrew-Shay closed 4 years ago

Andrew-Shay commented 4 years ago

The sample code in the documentation uses the deprecated rand_os https://docs.rs/rand_os/0.2.2/rand_os/

Deprecated since 0.2.2: OsRng is now provided by rand_core and rand

Is there a sample that uses rand_core or rand?

Here's a snippet that seems to work but I don't know if it's secure

use rand_core::{OsRng};
let mut alice_csprng = OsRng;
hdevalence commented 4 years ago

@Andrew-Shay Yes, that looks right to me. I'll try to update the docs tomorrow.