pbkdf2: use std.math.divCeil()

This commit is contained in:
Frank Denis 2021-03-17 10:11:47 +01:00
parent f609c4ddb3
commit 6d9b3e7b19

View File

@ -79,7 +79,7 @@ pub fn pbkdf2(dk: []u8, password: []const u8, salt: []const u8, rounds: u32, com
// block
//
const blocks_count = (dk_len + h_len - 1) / h_len;
const blocks_count = @intCast(u32, std.math.divCeil(usize, dk_len, h_len) catch unreachable);
var r = dk_len % h_len;
if (r == 0) {
r = h_len;