From f56eee5d320625f89c1e0b6b26c665e7506b127c Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 5 Feb 2013 02:01:13 +0100 Subject: optimise first part of the theta step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- java/SHA3.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'java') diff --git a/java/SHA3.java b/java/SHA3.java index 62a44b2..f71b355 100644 --- a/java/SHA3.java +++ b/java/SHA3.java @@ -173,11 +173,8 @@ public class SHA3 private static void keccakFRound(long[] A, long rc) { /* θ step (step 1 of 3) */ - SHA3.C[0] = (A[0] ^ A[1]) ^ (A[2] ^ A[3]) ^ A[4]; - SHA3.C[1] = (A[5] ^ A[6]) ^ (A[7] ^ A[8]) ^ A[9]; - SHA3.C[2] = (A[10] ^ A[11]) ^ (A[12] ^ A[13]) ^ A[14]; - SHA3.C[3] = (A[15] ^ A[16]) ^ (A[17] ^ A[18]) ^ A[19]; - SHA3.C[4] = (A[20] ^ A[21]) ^ (A[22] ^ A[23]) ^ A[24]; + for (int i = 0, j = 0; i < 5; i++, j += 5) + SHA3.C[i] = (A[j] ^ A[j + 1]) ^ (A[j + 2] ^ A[j + 3]) ^ A[j + 4]; if (SHA3.w == 64) { -- cgit v1.2.3-70-g09d2