Crate bcrypt_bsd

Source
Expand description

Rust wrapper around the BCrypt hashing algorithm implementation written in C.

The C implementation is embedded into this crate and compiled using build script.

§Example

use bcrypt_bsd::{gen_salt, hash, to_str};
 
let salt = gen_salt(12).unwrap();
let bcrypt_hash = hash("Password", &salt).unwrap();
 
println!("bcrypt salt: {}", to_str(&salt).unwrap());
println!("bcrypt hash: {}", to_str(&bcrypt_hash).unwrap());
 

Structs§

CryptError
BCrypt hashing error.

Functions§

gen_salt
Generate salt for a BCrypt hash.
hash
Compute BCrypt hash from a password and salt.
to_str
Convert a nul-terminated byte slice into a borrowed string.