std.crypto siphash: fix assertion on the size of output buffer

the logic was backwards
This commit is contained in:
Andrew Kelley 2020-09-16 02:24:36 -07:00
parent 7801a6d17f
commit 281fc10ec5

View File

@ -218,8 +218,9 @@ fn SipHash(comptime T: type, comptime c_rounds: usize, comptime d_rounds: usize)
}
/// Return an authentication tag for the current state
/// Assumes `out` is less than or equal to `mac_length`.
pub fn final(self: *Self, out: []u8) void {
std.debug.assert(out.len >= mac_length);
std.debug.assert(out.len <= mac_length);
mem.writeIntLittle(T, out[0..mac_length], self.state.final(self.buf[0..self.buf_len]));
}