mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 12:59:04 +00:00
pbkdf2 "very large dklen test" should just check for crashes
This commit is contained in:
parent
3f450b7e93
commit
17156e1775
@ -59,8 +59,10 @@ const mem = std.mem;
|
||||
/// salt: Arbitrary sequence of bytes of any length, including empty. A common length is 8 bytes.
|
||||
///
|
||||
/// rounds: Iteration count. Must be greater than 0. Common values range from 1,000 to 100,000.
|
||||
/// Larger iteration counts improve security by increasing the time required to compute
|
||||
/// the derivedKey. It is common to tune this parameter to achieve approximately 100ms.
|
||||
///
|
||||
/// Prf: Pseudo-random function to use. The most common choice is std.crypto.auth.hmac.HmacSha256.
|
||||
/// Prf: Pseudo-random function to use. A common choice is std.crypto.auth.hmac.HmacSha256.
|
||||
pub fn pbkdf2(derivedKey: []u8, password: []const u8, salt: []const u8, rounds: u32, comptime Prf: type) void {
|
||||
assert(rounds >= 1);
|
||||
|
||||
@ -263,8 +265,5 @@ test "Very large dkLen" {
|
||||
}
|
||||
|
||||
pbkdf2(derivedKey, p, s, c, crypto.auth.hmac.HmacSha1);
|
||||
|
||||
const expected = "0c60c80f961f0e71f3a9b524af6012062fe037a6";
|
||||
|
||||
htest.assertEqual(expected, derivedKey[0..]);
|
||||
// Just verify this doesn't crash with an overflow
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user