authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-10-07 13:07:32+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-10-15 10:09:06+02:00
logbb5ba74ab1d9e10fc4657ef68800192bab538341
tree42bbe79b3e02647fc8317f0e350c0866325343b1
parentb1ccf7eb1e6a3d499220d25cff300358669ad3db

Remove dead code in kangarootwelve

KeccakPlanes is not used any more in the current implementation.

1 files changed, 0 insertions(+), 50 deletions(-)

lib/std/crypto/kangarootwelve.zig-50
......@@ -316,56 +316,6 @@ fn addLanesAll(
316316 }
317317}
318318
319/// Apply Keccak-p[1600,12] to a single state (u64 lane representation)
320fn keccakPLanes(lanes: *[25]u64) void {
321 @setEvalBranchQuota(10000);
322
323 // Apply 12 rounds
324 inline for (RC) |rc| {
325 // θ
326 var C: [5]u64 = undefined;
327 inline for (0..5) |x| {
328 C[x] = lanes[x] ^ lanes[x + 5] ^ lanes[x + 10] ^ lanes[x + 15] ^ lanes[x + 20];
329 }
330 var D: [5]u64 = undefined;
331 inline for (0..5) |x| {
332 D[x] = C[(x + 4) % 5] ^ std.math.rotl(u64, C[(x + 1) % 5], 1);
333 }
334 inline for (0..5) |x| {
335 inline for (0..5) |y| {
336 lanes[x + 5 * y] ^= D[x];
337 }
338 }
339
340 // ρ and π
341 var current = lanes[1];
342 var px: usize = 1;
343 var py: usize = 0;
344 inline for (0..24) |t| {
345 const next_y = (2 * px + 3 * py) % 5;
346 const next_idx = py + 5 * next_y;
347 const temp = lanes[next_idx];
348 const rot_amount = ((t + 1) * (t + 2) / 2) % 64;
349 lanes[next_idx] = std.math.rotl(u64, current, @as(u6, @intCast(rot_amount)));
350 current = temp;
351 px = py;
352 py = next_y;
353 }
354
355 // χ
356 inline for (0..5) |y| {
357 const idx = 5 * y;
358 const T = [5]u64{ lanes[idx], lanes[idx + 1], lanes[idx + 2], lanes[idx + 3], lanes[idx + 4] };
359 inline for (0..5) |x| {
360 lanes[idx + x] = T[x] ^ (~T[(x + 1) % 5] & T[(x + 2) % 5]);
361 }
362 }
363
364 // ι
365 lanes[0] ^= rc;
366 }
367}
368
369319/// Generic non-allocating TurboSHAKE: write output to provided buffer
370320fn turboShakeMultiSliceToBuffer(
371321 comptime rate: usize,