structstd.crypto.bcrypt.Params[src]

bcrypt parameters

Fields

rounds_log: u6

log2 of the number of rounds

silently_truncate_password: bool

As originally defined, bcrypt silently truncates passwords to 72 bytes. In order to overcome this limitation, if silently_truncate_password is set to false, long passwords will be automatically pre-hashed using HMAC-SHA512 before being passed to bcrypt. Only set silently_truncate_password to true for compatibility with traditional bcrypt implementations, or if you want to handle the truncation yourself.

Values

Constantowasp[src]

Minimum recommended parameters according to the OWASP cheat sheet.

Source Code

Source code
pub const owasp = Self{ .rounds_log = 10, .silently_truncate_password = false }

Source Code

Source code
pub const Params = struct {
    const Self = @This();

    /// log2 of the number of rounds
    rounds_log: u6,

    /// As originally defined, bcrypt silently truncates passwords to 72 bytes.
    /// In order to overcome this limitation, if `silently_truncate_password` is set to `false`,
    /// long passwords will be automatically pre-hashed using HMAC-SHA512 before being passed to bcrypt.
    /// Only set `silently_truncate_password` to `true` for compatibility with traditional bcrypt implementations,
    /// or if you want to handle the truncation yourself.
    silently_truncate_password: bool,

    /// Minimum recommended parameters according to the
    /// [OWASP cheat sheet](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html).
    pub const owasp = Self{ .rounds_log = 10, .silently_truncate_password = false };
}