Use OsRng to get random data for seed

This commit is contained in:
Jeremy Soller
2016-10-24 14:07:55 -06:00
parent d32f2dc10e
commit 46631df4f0
3 changed files with 12 additions and 3 deletions
Generated
+7
View File
@@ -3,6 +3,7 @@ name = "userutils"
version = "0.1.0"
dependencies = [
"argon2rs 0.2.5 (git+https://github.com/redox-os/argon2rs.git)",
"rand 0.3.14 (git+https://github.com/redox-os/rand.git)",
"syscall 0.1.0",
"termion 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -39,6 +40,11 @@ version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
replace = "libc 0.2.17 (git+https://github.com/redox-os/liblibc.git?branch=new_kernel)"
[[package]]
name = "rand"
version = "0.3.14"
source = "git+https://github.com/redox-os/rand.git#ef2e59549dc2f78f9942ee978b2a31ca06e413b9"
[[package]]
name = "syscall"
version = "0.1.0"
@@ -57,4 +63,5 @@ dependencies = [
"checksum constant_time_eq 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "07dcb7959f0f6f1cf662f9a7ff389bcb919924d99ac41cf31f10d611d8721323"
"checksum libc 0.2.17 (git+https://github.com/redox-os/liblibc.git?branch=new_kernel)" = "<none>"
"checksum libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "044d1360593a78f5c8e5e710beccdc24ab71d1f01bc19a29bcacdba22e8475d8"
"checksum rand 0.3.14 (git+https://github.com/redox-os/rand.git)" = "<none>"
"checksum termion 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ce9884af069456867e19fd5648b8908d5c9378f586b2659aaa6f3a4088fdb867"
+2 -1
View File
@@ -27,8 +27,9 @@ name = "sudo"
path = "src/bin/sudo.rs"
[dependencies]
rand = { git = "https://github.com/redox-os/rand.git" }
syscall = { path = "../../syscall/" }
termion = "*"
termion = "1.1"
[dependencies.argon2rs]
git = "https://github.com/redox-os/argon2rs.git"
+3 -2
View File
@@ -1,10 +1,11 @@
extern crate termion;
extern crate rand;
extern crate userutils;
use rand::{Rng, OsRng};
use std::env;
fn main() {
let passwd = env::args().nth(1).unwrap();
let salt = env::args().nth(2).unwrap();
let salt = format!("{:X}", OsRng::new().unwrap().next_u64());
println!("{}", userutils::Passwd::encode(&passwd, &salt));
}