Skip to main content

bcrypt

Function bcrypt 

Source
pub fn bcrypt(cost: u32, salt: [u8; 16], password: &[u8]) -> [u8; 24]
Expand description

The raw bcrypt core: one hash of password with a caller-supplied salt, returning the full 24-byte ciphertext.

cost is not validated here — matching the bcrypt crate’s raw function (debug builds assert it is in 4..=31; release builds would just run). Every other entry point in this crate validates the cost up front and ends up here. The password is NUL-terminated and truncated at 72 bytes; use the non_truncating_* family to reject instead of truncate.

The string format drops the last of the 24 bytes; the hash-string APIs encode only out[..23].