Commit 39d68618 authored by Jeremy Soller's avatar Jeremy Soller

Switch to using rust-argon2 crate, which is more actively maintained

parent b75b1c2f
This diff is collapsed.
......@@ -16,13 +16,13 @@ path = "src/lib.rs"
[dependencies]
arg_parser = "0.1.0"
argon2rs = { version = "0.2.5", default-features = false }
liner = "0.4.4"
libc = "0.2.54"
failure = "0.1.5"
rand = "0.6.5"
redox_pkgutils = "0.1.2"
redoxfs = "0.3.3"
rust-argon2 = "0.5"
serde = "1.0.91"
serde_derive = "1.0.91"
termion = "1.5.2"
......
......@@ -2,7 +2,7 @@
#[macro_use]
extern crate serde_derive;
extern crate argon2rs;
extern crate argon2;
extern crate libc;
extern crate liner;
extern crate failure;
......@@ -15,8 +15,6 @@ mod config;
pub use config::Config;
use config::file::FileConfig;
use argon2rs::verifier::Encoded;
use argon2rs::{Argon2, Variant};
use failure::{Error, err_msg};
use rand::{RngCore, rngs::OsRng};
use termion::input::TermRead;
......@@ -36,17 +34,10 @@ const REMOTE: &'static str = "https://static.redox-os.org/pkg";
/// by redox_users. If the password is blank, the hash is blank.
fn hash_password(password: &str) -> Result<String> {
if password != "" {
let a2 = Argon2::new(10, 1, 4096, Variant::Argon2i)?;
let salt = format!("{:X}", OsRng::new()?.next_u64());
let enc = Encoded::new(
a2,
password.as_bytes(),
salt.as_bytes(),
&[],
&[]
);
Ok(String::from_utf8(enc.to_u8())?)
let config = argon2::Config::default();
let hash = argon2::hash_encoded(password.as_bytes(), salt.as_bytes(), &config)?;
Ok(hash)
} else {
Ok("".to_string())
}
......
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