Commit 281fc10ec5

Andrew Kelley <andrew@ziglang.org>
2020-09-16 11:24:36
std.crypto siphash: fix assertion on the size of output buffer
the logic was backwards
1 parent 7801a6d
Changed files (1)
lib
std
lib/std/crypto/siphash.zig
@@ -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]));
         }