secwords 1.1.1

secure and safe password (temporary) container.
Documentation

Secwords

CI Crates.io Licensed Twitter

secure and safe password (temporary) container.

  • typed system
  • memory safety
  • unicode safety (no-std support)

| Docs | Latest Note |

[dependencies]
secwords = "1.1.1"

or

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

How to

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

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

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

assert_eq!(pass1, pass2); // they are hashed, original is gone(safely)
assert_eq!(pass1.as_ref(), pass2.as_slice());
assert_eq!(pass1.to_vec(), pass2.to_vec());

assert_eq!(pass1, "pa5$wOrs");
assert_eq!(pass1, String::from("pa5$wOrs"));
assert_eq!(&pass1.to_hex().unwrap()[..20], "ed2757c9f4480697d789");
assert_eq!(pass1.to_hex().unwrap().len(), 512); // vep implementation
assert_eq!(format!("{}", pass1), "***SECURE***"); // display
assert_eq!(format!("{:?}", pass1), "***SECURE***"); // debug

there are more examples in the lib.rs