diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-02-04 01:42:09 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-02-04 01:42:09 +0100 |
commit | 341180d3b6c3f59b803c8d4d1552302fddfd3b3c (patch) | |
tree | 1e31b828006af046cff8195c7c41597ba96e7aaa | |
parent | some small optimisations (diff) | |
download | sha3sum-341180d3b6c3f59b803c8d4d1552302fddfd3b3c.tar.gz sha3sum-341180d3b6c3f59b803c8d4d1552302fddfd3b3c.tar.bz2 sha3sum-341180d3b6c3f59b803c8d4d1552302fddfd3b3c.tar.xz |
a little more round optimisation
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-x | sha3sum.py | 32 |
1 files changed, 29 insertions, 3 deletions
@@ -197,9 +197,35 @@ class SHA3: SHA3.B[4][0] = SHA3.rotate(A[4][4], 14) # ξ step - for x in range(5): - for y in range(5): - A[x][y] = SHA3.B[x][y] ^ ((~(SHA3.B[(x + 1) % 5][y])) & SHA3.B[(x + 2) % 5][y]) + A[0][0] = SHA3.B[0][0] ^ ((~(SHA3.B[1][0])) & SHA3.B[2][0]) + A[0][1] = SHA3.B[0][1] ^ ((~(SHA3.B[1][1])) & SHA3.B[2][1]) + A[0][2] = SHA3.B[0][2] ^ ((~(SHA3.B[1][2])) & SHA3.B[2][2]) + A[0][3] = SHA3.B[0][3] ^ ((~(SHA3.B[1][3])) & SHA3.B[2][3]) + A[0][4] = SHA3.B[0][4] ^ ((~(SHA3.B[1][4])) & SHA3.B[2][4]) + + A[1][0] = SHA3.B[1][0] ^ ((~(SHA3.B[2][0])) & SHA3.B[3][0]) + A[1][1] = SHA3.B[1][1] ^ ((~(SHA3.B[2][1])) & SHA3.B[3][1]) + A[1][2] = SHA3.B[1][2] ^ ((~(SHA3.B[2][2])) & SHA3.B[3][2]) + A[1][3] = SHA3.B[1][3] ^ ((~(SHA3.B[2][3])) & SHA3.B[3][3]) + A[1][4] = SHA3.B[1][4] ^ ((~(SHA3.B[2][4])) & SHA3.B[3][4]) + + A[2][0] = SHA3.B[2][0] ^ ((~(SHA3.B[3][0])) & SHA3.B[4][0]) + A[2][1] = SHA3.B[2][1] ^ ((~(SHA3.B[3][1])) & SHA3.B[4][1]) + A[2][2] = SHA3.B[2][2] ^ ((~(SHA3.B[3][2])) & SHA3.B[4][2]) + A[2][3] = SHA3.B[2][3] ^ ((~(SHA3.B[3][3])) & SHA3.B[4][3]) + A[2][4] = SHA3.B[2][4] ^ ((~(SHA3.B[3][4])) & SHA3.B[4][4]) + + A[3][0] = SHA3.B[3][0] ^ ((~(SHA3.B[4][0])) & SHA3.B[0][0]) + A[3][1] = SHA3.B[3][1] ^ ((~(SHA3.B[4][1])) & SHA3.B[0][1]) + A[3][2] = SHA3.B[3][2] ^ ((~(SHA3.B[4][2])) & SHA3.B[0][2]) + A[3][3] = SHA3.B[3][3] ^ ((~(SHA3.B[4][3])) & SHA3.B[0][3]) + A[3][4] = SHA3.B[3][4] ^ ((~(SHA3.B[4][4])) & SHA3.B[0][4]) + + A[4][0] = SHA3.B[4][0] ^ ((~(SHA3.B[0][0])) & SHA3.B[1][0]) + A[4][1] = SHA3.B[4][1] ^ ((~(SHA3.B[0][1])) & SHA3.B[1][1]) + A[4][2] = SHA3.B[4][2] ^ ((~(SHA3.B[0][2])) & SHA3.B[1][2]) + A[4][3] = SHA3.B[4][3] ^ ((~(SHA3.B[0][3])) & SHA3.B[1][3]) + A[4][4] = SHA3.B[4][4] ^ ((~(SHA3.B[0][4])) & SHA3.B[1][4]) # ι step A[0][0] ^= rc |