| Crates.io | xcrypt |
| lib.rs | xcrypt |
| version | 0.3.2 |
| created_at | 2024-10-09 13:27:16.502478+00 |
| updated_at | 2025-09-16 15:06:50.194363+00 |
| description | Bindings for libxcrypt |
| homepage | https://github.com/nikstur/libxcrypt-rs |
| repository | https://github.com/nikstur/libxcrypt-rs |
| max_upload_size | |
| id | 1402386 |
| size | 18,606 |
Rust bindings for libxcrypt
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}");
}
You should run cargo-valgrind on the tests to ensure we do not leak memory:
cargo valgrind tests