diff --git a/lib/std/crypto/keccak_p.zig b/lib/std/crypto/keccak_p.zig index b707833e2d7a5a56cc8c38cd989ff6bee5a9b0a1..9164ba48bab7b6776ac8a4ab7f79d28b492c8120 100644 --- a/lib/std/crypto/keccak_p.zig +++ b/lib/std/crypto/keccak_p.zig @@ -177,8 +177,9 @@ pub fn KeccakF(comptime f: u11) type { /// Apply a (possibly) reduced-round permutation to the state. pub fn permuteR(self: *Self, comptime rounds: u5) void { + comptime assert(rounds <= max_rounds); // Keccak only supports up to 24 rounds var i = RC.len - rounds; - while (i < RC.len - RC.len % 3) : (i += 3) { + while (i < RC.len - rounds % 3) : (i += 3) { self.round(RC[i]); self.round(RC[i + 1]); self.round(RC[i + 2]);