aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-05 01:57:54 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-05 01:57:54 +0100
commit9cbbaa9934b0ea50412ad425ded43beb195d9117 (patch)
tree34d97bc38c9d8cbb6753ee01b101aeccd9b28d19 /java
parenta bit of optimisation on the round (last part) (diff)
downloadsha3sum-9cbbaa9934b0ea50412ad425ded43beb195d9117.tar.gz
sha3sum-9cbbaa9934b0ea50412ad425ded43beb195d9117.tar.bz2
sha3sum-9cbbaa9934b0ea50412ad425ded43beb195d9117.tar.xz
optimise chi step
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--java/SHA3.java38
1 files changed, 8 insertions, 30 deletions
diff --git a/java/SHA3.java b/java/SHA3.java
index 27d5b2a..62a44b2 100644
--- a/java/SHA3.java
+++ b/java/SHA3.java
@@ -261,36 +261,14 @@ public class SHA3
}
/* ξ step */
- A[0] = SHA3.B[0] ^ ((~(SHA3.B[5])) & SHA3.B[10]);
- A[1] = SHA3.B[1] ^ ((~(SHA3.B[6])) & SHA3.B[11]);
- A[2] = SHA3.B[2] ^ ((~(SHA3.B[7])) & SHA3.B[12]);
- A[3] = SHA3.B[3] ^ ((~(SHA3.B[8])) & SHA3.B[13]);
- A[4] = SHA3.B[4] ^ ((~(SHA3.B[9])) & SHA3.B[14]);
-
- A[5] = SHA3.B[5] ^ ((~(SHA3.B[10])) & SHA3.B[15]);
- A[6] = SHA3.B[6] ^ ((~(SHA3.B[11])) & SHA3.B[16]);
- A[7] = SHA3.B[7] ^ ((~(SHA3.B[12])) & SHA3.B[17]);
- A[8] = SHA3.B[8] ^ ((~(SHA3.B[13])) & SHA3.B[18]);
- A[9] = SHA3.B[9] ^ ((~(SHA3.B[14])) & SHA3.B[19]);
-
- A[10] = SHA3.B[10] ^ ((~(SHA3.B[15])) & SHA3.B[20]);
- A[11] = SHA3.B[11] ^ ((~(SHA3.B[16])) & SHA3.B[21]);
- A[12] = SHA3.B[12] ^ ((~(SHA3.B[17])) & SHA3.B[22]);
- A[13] = SHA3.B[13] ^ ((~(SHA3.B[18])) & SHA3.B[23]);
- A[14] = SHA3.B[14] ^ ((~(SHA3.B[19])) & SHA3.B[24]);
-
- A[15] = SHA3.B[15] ^ ((~(SHA3.B[20])) & SHA3.B[0]);
- A[16] = SHA3.B[16] ^ ((~(SHA3.B[21])) & SHA3.B[1]);
- A[17] = SHA3.B[17] ^ ((~(SHA3.B[22])) & SHA3.B[2]);
- A[18] = SHA3.B[18] ^ ((~(SHA3.B[23])) & SHA3.B[3]);
- A[19] = SHA3.B[19] ^ ((~(SHA3.B[24])) & SHA3.B[4]);
-
- A[20] = SHA3.B[20] ^ ((~(SHA3.B[0])) & SHA3.B[5]);
- A[21] = SHA3.B[21] ^ ((~(SHA3.B[1])) & SHA3.B[6]);
- A[22] = SHA3.B[22] ^ ((~(SHA3.B[2])) & SHA3.B[7]);
- A[23] = SHA3.B[23] ^ ((~(SHA3.B[3])) & SHA3.B[8]);
- A[24] = SHA3.B[24] ^ ((~(SHA3.B[4])) & SHA3.B[9]);
-
+ for (int i = 0; i < 15; i++)
+ A[i ] = SHA3.B[i ] ^ ((~(SHA3.B[i + 5])) & SHA3.B[i + 10]);
+ for (int i = 0; i < 5; i++)
+ {
+ A[i + 15] = SHA3.B[i + 15] ^ ((~(SHA3.B[i + 20])) & SHA3.B[i ]);
+ A[i + 20] = SHA3.B[i + 20] ^ ((~(SHA3.B[i ])) & SHA3.B[i + 5]);
+ }
+
/* ι step */
A[0] ^= rc;
}