pbkdf2 offset into dk should be usize, not u64.

This commit is contained in:
Rob Napier 2020-09-13 12:36:32 -04:00
parent 2f9c9662ba
commit 85366771ea

View File

@ -130,7 +130,7 @@ pub fn pbkdf2(derivedKey: []u8, password: []const u8, salt: []const u8, rounds:
ctx.final(prevBlock[0..]);
// Choose portion of DK to write into (T_n) and initialize
const offset: u64 = @as(u64, block) * hLen;
const offset: usize = @as(usize, block) * hLen;
const blockLen = if (block != l - 1) hLen else r;
var dkBlock = derivedKey[offset..(offset + blockLen)];
mem.copy(u8, dkBlock, prevBlock[0..dkBlock.len]);