diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-02-05 02:01:13 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-02-05 02:01:13 +0100 |
commit | f56eee5d320625f89c1e0b6b26c665e7506b127c (patch) | |
tree | 11cc1a0f07c80c9faf3b28768d6f0c8b6734aec6 /java | |
parent | optimise chi step (diff) | |
download | sha3sum-f56eee5d320625f89c1e0b6b26c665e7506b127c.tar.gz sha3sum-f56eee5d320625f89c1e0b6b26c665e7506b127c.tar.bz2 sha3sum-f56eee5d320625f89c1e0b6b26c665e7506b127c.tar.xz |
optimise first part of the theta step
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | java/SHA3.java | 7 |
1 files changed, 2 insertions, 5 deletions
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) { |