Commit 74986ef2 authored by Blaž Hrastnik's avatar Blaž Hrastnik

Swap rand for getrandom.

parent 6a7f40a2
Pipeline #5913 passed with stages
in 3 minutes and 41 seconds
......@@ -11,5 +11,5 @@ keywords = ["redox", "auth"]
[dependencies]
rust-argon2 = "0.5"
rand = "0.7"
getrandom = "0.1"
redox_syscall = "0.1"
......@@ -27,7 +27,7 @@
//! software.
extern crate argon2;
extern crate rand;
extern crate getrandom;
extern crate syscall;
use std::convert::From;
......@@ -46,9 +46,6 @@ use std::str::FromStr;
use std::thread;
use std::time::Duration;
use rand::rngs::{OsRng, StdRng};
use rand::{RngCore, SeedableRng};
#[cfg(target_os = "redox")]
use syscall::flag::{O_EXLOCK, O_SHLOCK};
use syscall::Error as SyscallError;
......@@ -208,7 +205,9 @@ impl User {
let password = password.as_ref();
self.hash = if password != "" {
let salt = format!("{:X}", OsRng.next_u64());
let mut buf = [0u8; 8];
getrandom::getrandom(&mut buf)?;
let salt = format!("{:X}", u64::from_ne_bytes(buf));
let config = argon2::Config::default();
let hash = argon2::hash_encoded(
password.as_bytes(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment