| ... | @@ -205,7 +205,7 @@ pub fn State128X(comptime degree: u7) type { | ... | @@ -205,7 +205,7 @@ pub fn State128X(comptime degree: u7) type { |
| 205 | }) }; | 205 | }) }; |
| 206 | const input = packRate(nonce_block, key_block); | 206 | const input = packRate(nonce_block, key_block); |
| 207 | for (0..10) |_| { | 207 | for (0..10) |_| { |
| 208 | for (&state.words, context_mask) |*w, m| w.* ^= m; | 208 | inline for (&state.words, context_mask) |*w, m| w.* ^= m; |
| 209 | state.update(&input); | 209 | state.update(&input); |
| 210 | } | 210 | } |
| 211 | return state; | 211 | return state; |
| ... | @@ -214,7 +214,7 @@ pub fn State128X(comptime degree: u7) type { | ... | @@ -214,7 +214,7 @@ pub fn State128X(comptime degree: u7) type { |
| 214 | fn update(state: *State, input: *const Aes.Bitsliced) void { | 214 | fn update(state: *State, input: *const Aes.Bitsliced) void { |
| 215 | var st1 = state.words; | 215 | var st1 = state.words; |
| 216 | Aes.round(&st1); | 216 | Aes.round(&st1); |
| 217 | for (&state.words, st1, input) |*w, r, in| { | 217 | inline for (&state.words, st1, input) |*w, r, in| { |
| 218 | w.* ^= (((r & V.mask(0xfe)) >> 1) | ((r & V.mask(0x01)) << 7)) ^ in; | 218 | w.* ^= (((r & V.mask(0xfe)) >> 1) | ((r & V.mask(0x01)) << 7)) ^ in; |
| 219 | } | 219 | } |
| 220 | } | 220 | } |
| ... | @@ -225,7 +225,7 @@ pub fn State128X(comptime degree: u7) type { | ... | @@ -225,7 +225,7 @@ pub fn State128X(comptime degree: u7) type { |
| 225 | | 225 | |
| 226 | fn keystream(state: *const State) [2][4]Word { | 226 | fn keystream(state: *const State) [2][4]Word { |
| 227 | var z: Aes.Bitsliced = undefined; | 227 | var z: Aes.Bitsliced = undefined; |
| 228 | for (&z, &state.words) |*zw, x| { | 228 | inline for (&z, &state.words) |*zw, x| { |
| 229 | zw.* = ((x & V.mask(0x02)) << 6) ^ ((x & V.mask(0x40)) << 1) ^ | 229 | zw.* = ((x & V.mask(0x02)) << 6) ^ ((x & V.mask(0x40)) << 1) ^ |
| 230 | (((x & V.mask(0x20)) << 2) & ((x & V.mask(0x10)) << 3)) ^ | 230 | (((x & V.mask(0x20)) << 2) & ((x & V.mask(0x10)) << 3)) ^ |
| 231 | ((x & V.mask(0x20)) >> 2) ^ ((x & V.mask(0x04)) << 1) ^ | 231 | ((x & V.mask(0x20)) >> 2) ^ ((x & V.mask(0x04)) << 1) ^ |
| ... | @@ -354,7 +354,7 @@ pub fn State256X(comptime degree: u7) type { | ... | @@ -354,7 +354,7 @@ pub fn State256X(comptime degree: u7) type { |
| 354 | }; | 354 | }; |
| 355 | for (0..4) |_| { | 355 | for (0..4) |_| { |
| 356 | for (&inputs) |*input| { | 356 | for (&inputs) |*input| { |
| 357 | for (&state.words, context_mask) |*w, m| w.* ^= m; | 357 | inline for (&state.words, context_mask) |*w, m| w.* ^= m; |
| 358 | state.update(input); | 358 | state.update(input); |
| 359 | } | 359 | } |
| 360 | } | 360 | } |
| ... | @@ -364,7 +364,7 @@ pub fn State256X(comptime degree: u7) type { | ... | @@ -364,7 +364,7 @@ pub fn State256X(comptime degree: u7) type { |
| 364 | fn update(state: *State, input: *const Aes.Bitsliced) void { | 364 | fn update(state: *State, input: *const Aes.Bitsliced) void { |
| 365 | var st1 = state.words; | 365 | var st1 = state.words; |
| 366 | Aes.round(&st1); | 366 | Aes.round(&st1); |
| 367 | for (&state.words, st1, input) |*w, r, in| { | 367 | inline for (&state.words, st1, input) |*w, r, in| { |
| 368 | w.* ^= (((r & V.mask(0xf8)) >> 1) | ((r & V.mask(0x04)) << 5)) ^ in; | 368 | w.* ^= (((r & V.mask(0xf8)) >> 1) | ((r & V.mask(0x04)) << 5)) ^ in; |
| 369 | } | 369 | } |
| 370 | } | 370 | } |
| ... | @@ -375,7 +375,7 @@ pub fn State256X(comptime degree: u7) type { | ... | @@ -375,7 +375,7 @@ pub fn State256X(comptime degree: u7) type { |
| 375 | | 375 | |
| 376 | fn keystream(state: *const State) [4]Word { | 376 | fn keystream(state: *const State) [4]Word { |
| 377 | var z: Aes.Bitsliced = undefined; | 377 | var z: Aes.Bitsliced = undefined; |
| 378 | for (&z, &state.words) |*zw, x| { | 378 | inline for (&z, &state.words) |*zw, x| { |
| 379 | zw.* = ((x & V.mask(0x40)) << 1) ^ ((x & V.mask(0x08)) << 4) ^ | 379 | zw.* = ((x & V.mask(0x40)) << 1) ^ ((x & V.mask(0x08)) << 4) ^ |
| 380 | ((x & V.mask(0x04)) << 5) ^ | 380 | ((x & V.mask(0x04)) << 5) ^ |
| 381 | (((x & V.mask(0x20)) << 2) & ((x & V.mask(0x10)) << 3)); | 381 | (((x & V.mask(0x20)) << 2) & ((x & V.mask(0x10)) << 3)); |