#bcrypt #hash

bcrypt-bsd

Rust wrapper around BCrypt implementation in C, fully compatible with OpenBSD bcrypt

4 releases

Uses old Rust 2015

0.1.3 Sep 26, 2017
0.1.2 Sep 26, 2017
0.1.1 Sep 26, 2017
0.1.0 Sep 26, 2017

#14 in #bcrypt

MIT license

64KB
1.5K SLoC

C 1.5K SLoC // 0.1% comments GNU Style Assembly 157 SLoC // 0.1% comments Rust 136 SLoC // 0.0% comments

bcrypt-bsd

Rust interface to the C bcrypt library, fully compatible with OpenBSD bcrypt.


lib.rs:

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());

Dependencies

~315–560KB