feat: add password-hash

This commit is contained in:
2021-02-11 14:53:25 +08:00
parent bf7b9275c1
commit d383b36f00
4 changed files with 56 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
use password_hash::{PasswordHash, ParamsString, Salt, Ident};
fn main() {
let ph = PasswordHash{
algorithm: Ident::new("argon2d"),
version:None,
params:ParamsString::new(),
salt:Some(Salt::new("sample").unwrap()),
hash:None,
};
PasswordHash::generate()
let bs = "hello world".as_bytes();
let bs_len = ph.encoding().encoded_len(bs);
let mut output = vec![0u8; bs_len];
let r = ph.encoding().encode("hello world".as_bytes(), &mut output);
println!("P: {:?}", r);
println!("P: {:?}", output);
}