aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobin Krahl <robin.krahl@ireas.org>2019-07-16 08:58:37 +0000
committerRobin Krahl <robin.krahl@ireas.org>2019-07-16 11:00:20 +0200
commit6c138eaa850c745b97b7e48a201db0cbaad8e1e0 (patch)
treee3d202e09ec6c99054e7103578a961b949773709 /src
parentf150d59410eefdec2ae69b2422906a3d1d88aa07 (diff)
downloadnitrokey-rs-6c138eaa850c745b97b7e48a201db0cbaad8e1e0.tar.gz
nitrokey-rs-6c138eaa850c745b97b7e48a201db0cbaad8e1e0.tar.bz2
Update rand_{core,os} dependencies
This patch updates the rand_core dependency to version 0.5 and the rand_os dependency to version 0.2. This causes a change in util.rs: Instead of constructing an OsRng instance using OsRng::new(), we can directly instantiate the (now empty) struct.
Diffstat (limited to 'src')
-rw-r--r--src/util.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/util.rs b/src/util.rs
index fdb73c3..a5dd1e5 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -77,9 +77,8 @@ pub fn get_last_error() -> Error {
}
pub fn generate_password(length: usize) -> Result<Vec<u8>, Error> {
- let mut rng = OsRng::new().map_err(|err| Error::RandError(Box::new(err)))?;
let mut data = vec![0u8; length];
- rng.fill_bytes(&mut data[..]);
+ OsRng.fill_bytes(&mut data[..]);
Ok(data)
}