strHash
Compute a hash of a password using the scrypt key derivation function. The function returns a string that includes all the parameters required for verification.
Function parameters
Parameters
- password:[]const u8
- out:[]u8
Scrypt parameters
Types
- Params
- Scrypt parameters
- HashOptions
- Options for hashing a password.
- VerifyOptions
- Options for hash verification.
Apply scrypt to generate a key from a password.
Functions
Source
Implementation
pub fn strHash(
password: []const u8,
options: HashOptions,
out: []u8,
) Error![]const u8 {
const allocator = options.allocator orelse return Error.AllocatorRequired;
switch (options.encoding) {
.phc => return PhcFormatHasher.create(allocator, password, options.params, out),
.crypt => return CryptFormatHasher.create(allocator, password, options.params, out),
}
}