21 lines
571 B
Rust
21 lines
571 B
Rust
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);
|
|
}
|