Secwords

CI Crates.io Licensed Twitter

secure and safe password (temporary) container.

| Docs | Latest Note |

toml [dependencies] secwords = "2.0.0"

or

toml [dependencies] secwords = { version = "2.0.0", default-features = false } # no-std


How to

``rust use secwords::Password; use sha2::Sha256; // can be any hasher of dyn Digestdigest` crate

let plain = String::from("pa5$wOrs"); // <- example

let pass1 = Password::::new(plain).unwrap(); // min length = 6 let pass2: Password = "pa5$wOrs".parse().unwrap();

asserteq!(pass1, pass2); // they are hashed, original is gone(safely) asserteq!(pass1.asref(), pass2.asslice()); asserteq!(pass1.tovec(), pass2.to_vec());

asserteq!(pass1, "pa5$wOrs"); asserteq!(pass1, String::from("pa5$wOrs")); asserteq!(&pass1.tohex().unwrap()[..20], "923482c5795a1ce3ee33"); asserteq!(pass1.tohex().unwrap().len(), 512); // vep implementation asserteq!(format!("{}", pass1), "*SECURE*"); // display asserteq!(format!("{:?}", pass1), "SECURE"); // debug `` there are more examples in thelib.rs`