feat: add password-hash
This commit is contained in:
23
__crypto/password-hash/Cargo.lock
generated
Normal file
23
__crypto/password-hash/Cargo.lock
generated
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
[[package]]
|
||||||
|
name = "base64ct"
|
||||||
|
version = "0.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "22fb38fd6e62e4ceec8543db40ceb714454ff173451a0f2a6c8952fdf39a2d6c"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "password-hash"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"password-hash 0.1.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "password-hash"
|
||||||
|
version = "0.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "721a49e14f1803441886c688ba8b653b52e1dcc926969081d22384e300ea4106"
|
||||||
|
dependencies = [
|
||||||
|
"base64ct",
|
||||||
|
]
|
||||||
10
__crypto/password-hash/Cargo.toml
Normal file
10
__crypto/password-hash/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "password-hash"
|
||||||
|
version = "0.1.0"
|
||||||
|
authors = ["Hatter Jiang@Pixelbook <jht5945@gmail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
password-hash = "0.1"
|
||||||
3
__crypto/password-hash/README.md
Normal file
3
__crypto/password-hash/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
I really DO NOT how to use this crate
|
||||||
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