diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-02-18 09:02:57 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-02-18 19:17:21 -0700 |
| commit | aeaef8c0ffadab4145fd002f2edd87a6db66ebd1 (patch) | |
| tree | e4c76c76173e5e72bc1947e1886662c4c6b2ba3c /lib/std/crypto/cmac.zig | |
| parent | f0530385b57218ef323747bdb7438330a07d25cc (diff) | |
| download | zig-aeaef8c0ffadab4145fd002f2edd87a6db66ebd1.tar.gz zig-aeaef8c0ffadab4145fd002f2edd87a6db66ebd1.zip | |
update std lib and compiler sources to new for loop syntax
Diffstat (limited to 'lib/std/crypto/cmac.zig')
| -rw-r--r-- | lib/std/crypto/cmac.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/crypto/cmac.zig b/lib/std/crypto/cmac.zig index 911eac7902..fd00461858 100644 --- a/lib/std/crypto/cmac.zig +++ b/lib/std/crypto/cmac.zig @@ -46,19 +46,19 @@ pub fn Cmac(comptime BlockCipher: type) type { const left = block_length - self.pos; var m = msg; if (m.len > left) { - for (self.buf[self.pos..]) |*b, i| b.* ^= m[i]; + for (self.buf[self.pos..], 0..) |*b, i| b.* ^= m[i]; m = m[left..]; self.cipher_ctx.encrypt(&self.buf, &self.buf); self.pos = 0; } while (m.len > block_length) { - for (self.buf[0..block_length]) |*b, i| b.* ^= m[i]; + for (self.buf[0..block_length], 0..) |*b, i| b.* ^= m[i]; m = m[block_length..]; self.cipher_ctx.encrypt(&self.buf, &self.buf); self.pos = 0; } if (m.len > 0) { - for (self.buf[self.pos..][0..m.len]) |*b, i| b.* ^= m[i]; + for (self.buf[self.pos..][0..m.len], 0..) |*b, i| b.* ^= m[i]; self.pos += m.len; } } @@ -69,7 +69,7 @@ pub fn Cmac(comptime BlockCipher: type) type { mac = self.k2; mac[self.pos] ^= 0x80; } - for (mac) |*b, i| b.* ^= self.buf[i]; + for (&mac, 0..) |*b, i| b.* ^= self.buf[i]; self.cipher_ctx.encrypt(out, &mac); } |
