diff --git a/Cargo.toml b/Cargo.toml index d974c3b..9c1b578 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,5 +12,5 @@ unix_socket = "0.4.3" rustc-serialize = "0.3" libc = "0.2" dbus-serialize = "0.1" -rand = "0.3" +rand = "0.5" rust-crypto = "0.2.31" diff --git a/src/connection.rs b/src/connection.rs index 64634a5..327d01c 100644 --- a/src/connection.rs +++ b/src/connection.rs @@ -34,8 +34,8 @@ use std::cell::RefCell; use std::str::FromStr; use std::string; use std::num::ParseIntError; -use rand::Rand; use rand; +use rand::prelude::*; use libc; use crypto::digest::Digest; use crypto; @@ -286,8 +286,9 @@ impl Connection { let cookie = try!(get_cookie(words[0], words[1])); let mut my_challenge = Vec::new(); + let mut rng = rand::thread_rng(); for _ in 0..16 { - my_challenge.push(u8::rand(&mut rand::thread_rng())); + my_challenge.push(rng.gen()); } let hex_challenge = my_challenge.to_hex();