3 releases (breaking)
0.3.0 | Oct 10, 2024 |
---|---|
0.2.0 | Oct 10, 2024 |
0.1.0 | Oct 9, 2024 |
#275 in Authentication
444 downloads per month
11KB
137 lines
libxcrypt-rs
Rust bindings for libxcrypt
Usage
Add xcrypt
to your Cargo.toml
:
cargo add xcrypt
Hash a phrase with the best available hashing method and default parameters:
use xcrypt::{crypt, crypt_gensalt};
fn main() {
let setting = crypt_gensalt(None, 0, None).unwrap();
let hashed_phrase = crypt("hello", &setting).unwrap();
println!("{hashed_phrase}");
}
lib.rs
:
Bindings for libxcrypt.
Examples
Hash a phrase with the best available hashing method and default parameters:
use xcrypt::{crypt, crypt_gensalt};
let setting = crypt_gensalt(None, 0, None).unwrap();
crypt("hello", &setting);
You can also explicitly request a specific hashing method:
use xcrypt::{crypt, crypt_gensalt};
let setting = crypt_gensalt(Some("$6$"), 0, None).unwrap();
crypt("hello", &setting);
Dependencies
~0–1.9MB
~37K SLoC