diff --git a/__crypto/password-hash/Cargo.lock b/__crypto/password-hash/Cargo.lock new file mode 100644 index 0000000..5b7484d --- /dev/null +++ b/__crypto/password-hash/Cargo.lock @@ -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", +] diff --git a/__crypto/password-hash/Cargo.toml b/__crypto/password-hash/Cargo.toml new file mode 100644 index 0000000..06ae53c --- /dev/null +++ b/__crypto/password-hash/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "password-hash" +version = "0.1.0" +authors = ["Hatter Jiang@Pixelbook "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +password-hash = "0.1" \ No newline at end of file diff --git a/__crypto/password-hash/README.md b/__crypto/password-hash/README.md new file mode 100644 index 0000000..7915ec6 --- /dev/null +++ b/__crypto/password-hash/README.md @@ -0,0 +1,3 @@ + + +I really DO NOT how to use this crate diff --git a/__crypto/password-hash/src/main.rs b/__crypto/password-hash/src/main.rs new file mode 100644 index 0000000..b6aabbf --- /dev/null +++ b/__crypto/password-hash/src/main.rs @@ -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); +}