Compute a deterministic hash of a password using the scrypt 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.
pub fn strHashWithSalt(
password: []const u8,
options: HashOptions,
out: []u8,
salt: *const [default_salt_len]u8,
) Error![]const u8
pub fn strHashWithSalt(
password: []const u8,
options: HashOptions,
out: []u8,
salt: *const [default_salt_len]u8,
) Error![]const u8 {
const allocator = options.allocator orelse return Error.AllocatorRequired;
switch (options.encoding) {
.phc => return PhcFormatHasher.createWithSalt(allocator, password, options.params, out, salt),
.crypt => return CryptFormatHasher.createWithSalt(allocator, password, options.params, out, salt),
}
}