feat: add password-hash
This commit is contained in:
20
__crypto/password-hash/src/main.rs
Normal file
20
__crypto/password-hash/src/main.rs
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user