File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 21
21
unused_qualifications
22
22
) ]
23
23
24
+ //! # Usage
25
+ //! ## Password Hashing
26
+ //! NOTE: the `simple` crate feature must be enabled (on-by-default)
27
+ #![ cfg_attr( feature = "simple" , doc = "```" ) ]
28
+ #![ cfg_attr( not( feature = "simple" ) , doc = "```ignore" ) ]
29
+ //! # fn main() -> yescrypt::Result<()> {
30
+ //! let password = b"pleaseletmein"; // don't actually use this as a password!
31
+ //! let salt = b"WZaPV7LSUEKMo34."; // unique per password, ideally 16-bytes and random
32
+ //! let password_hash = yescrypt::yescrypt(password, salt, &Default::default())?;
33
+ //! assert_eq!(&password_hash[..3], "$y$");
34
+ //! # Ok(())
35
+ //! # }
36
+ //! ```
37
+ //!
38
+ //! ## Key Derivation Function (KDF)
39
+ #![ cfg_attr( feature = "simple" , doc = "```" ) ]
40
+ #![ cfg_attr( not( feature = "simple" ) , doc = "```ignore" ) ]
41
+ //! # fn main() -> yescrypt::Result<()> {
42
+ //! let password = b"pleaseletmein"; // don't actually use this as a password!
43
+ //! let salt = b"WZaPV7LSUEKMo34."; // unique per password, ideally 16-bytes and random
44
+ //!
45
+ //! let mut output = [0u8; 32]; // can be sized as desired
46
+ //! yescrypt::yescrypt_kdf(password, salt, &Default::default(), &mut output)?;
47
+ //! # Ok(())
48
+ //! # }
49
+ //! ```
50
+
24
51
// Adapted from the yescrypt reference implementation available at:
25
52
// <https://github.com/openwall/yescrypt>
26
53
//
You can’t perform that action at this time.
0 commit comments