Zig 0.17.0-dev (Split by item)

This is an example of documentation generated by ZigDoc, an alternative to Zig's built-in Auto Doc feature. See also examples in other modes/formats. The project being documented here (as the example) is the Zig library itself.

strHashWithSalt

Compute a deterministic hash of a password using the bcrypt key derivation function. The function returns a string that includes all the parameters required for verification. Uses the provided salt instead of generating one randomly.

bcrypt.strHashWithSalt
pub fn strHashWithSalt(
    password: []const u8,
    options: HashOptions,
    out: []u8,
    salt: [salt_length]u8,
) Error![]const u8

File

lib/std/crypto/bcrypt.zig:808

Code

pub fn strHashWithSalt(
    password: []const u8,
    options: HashOptions,
    out: []u8,
    salt: [salt_length]u8,
) Error![]const u8 {
    switch (options.encoding) {
        .phc => return PhcFormatHasher.createWithSalt(password, options.params, out, salt),
        .crypt => return CryptFormatHasher.createWithSalt(password, options.params, out, &salt),
    }
}