diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-11-04 07:38:00 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-11-04 07:38:10 +0100 |
commit | fc38bb90abd9785e686e5e986ffe916753961f1c (patch) | |
tree | a8d03d8494a775d66ee9711b1a1253865bbf0877 | |
parent | derp (diff) | |
download | sha3sum-fc38bb90abd9785e686e5e986ffe916753961f1c.tar.gz sha3sum-fc38bb90abd9785e686e5e986ffe916753961f1c.tar.bz2 sha3sum-fc38bb90abd9785e686e5e986ffe916753961f1c.tar.xz |
whoops, error in non-python version when hashing with a wordsize below 64 bits
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | c/sha3.c | 4 | ||||
-rw-r--r-- | java-c-jni/SHA3.c | 4 | ||||
-rw-r--r-- | java/ConcurrentSHA3.java | 100 | ||||
-rw-r--r-- | java/SHA3.java | 100 |
4 files changed, 104 insertions, 104 deletions
@@ -636,7 +636,7 @@ void sha3_update(byte* restrict_ msg, long msglen) else for (i = 0; i < nnn; i += rr) { - #define __S(Si, OFF) S[Si] ^= sha3_toLane(message, len, rr, ww, OFF * w) + #define __S(Si, OFF) S[Si] ^= sha3_toLane(message, len, rr, ww, OFF * ww) __S( 0, 0); __S( 5, 1); __S(10, 2); __S(15, 3); __S(20, 4); __S( 1, 5); __S( 6, 6); __S(11, 7); __S(16, 8); __S(21, 9); __S( 2, 10); __S( 7, 11); __S(12, 12); __S(17, 13); __S(22, 14); @@ -759,7 +759,7 @@ byte* sha3_digest(byte* restrict_ msg, long msglen, long bits, char* restrict_ s else for (i = 0; i < nnn; i += rr) { - #define __S(Si, OFF) S[Si] ^= sha3_toLane(message, len, rr, ww, OFF * w) + #define __S(Si, OFF) S[Si] ^= sha3_toLane(message, len, rr, ww, OFF * ww) __S( 0, 0); __S( 5, 1); __S(10, 2); __S(15, 3); __S(20, 4); __S( 1, 5); __S( 6, 6); __S(11, 7); __S(16, 8); __S(21, 9); __S( 2, 10); __S( 7, 11); __S(12, 12); __S(17, 13); __S(22, 14); diff --git a/java-c-jni/SHA3.c b/java-c-jni/SHA3.c index 9422b3c..73b161d 100644 --- a/java-c-jni/SHA3.c +++ b/java-c-jni/SHA3.c @@ -602,7 +602,7 @@ void update(byte* msg, long msglen) else for (i = 0; i < nnn; i += rr) { - #define __S(Si, OFF) S[Si] ^= toLane(message, len, rr, ww, OFF * w) + #define __S(Si, OFF) S[Si] ^= toLane(message, len, rr, ww, OFF * ww) __S( 0, 0); __S( 5, 1); __S(10, 2); __S(15, 3); __S(20, 4); __S( 1, 5); __S( 6, 6); __S(11, 7); __S(16, 8); __S(21, 9); __S( 2, 10); __S( 7, 11); __S(12, 12); __S(17, 13); __S(22, 14); @@ -699,7 +699,7 @@ byte* digest(byte* msg, long msglen, long bits, int* suffix, long suffix_len, bo else for (i = 0; i < nnn; i += rr) { - #define __S(Si, OFF) S[Si] ^= toLane(message, len, rr, ww, OFF * w) + #define __S(Si, OFF) S[Si] ^= toLane(message, len, rr, ww, OFF * ww) __S( 0, 0); __S( 5, 1); __S(10, 2); __S(15, 3); __S(20, 4); __S( 1, 5); __S( 6, 6); __S(11, 7); __S(16, 8); __S(21, 9); __S( 2, 10); __S( 7, 11); __S(12, 12); __S(17, 13); __S(22, 14); diff --git a/java/ConcurrentSHA3.java b/java/ConcurrentSHA3.java index 622feb5..90569f8 100644 --- a/java/ConcurrentSHA3.java +++ b/java/ConcurrentSHA3.java @@ -471,31 +471,31 @@ public class ConcurrentSHA3 else for (int i = 0; i < len; i += rr) { - this.S[ 0] ^= this.toLane(n, ww, i + 0 ); - this.S[ 5] ^= this.toLane(n, ww, i + w); - this.S[10] ^= this.toLane(n, ww, i + 2 * w); - this.S[15] ^= this.toLane(n, ww, i + 3 * w); - this.S[20] ^= this.toLane(n, ww, i + 4 * w); - this.S[ 1] ^= this.toLane(n, ww, i + 5 * w); - this.S[ 6] ^= this.toLane(n, ww, i + 6 * w); - this.S[11] ^= this.toLane(n, ww, i + 7 * w); - this.S[16] ^= this.toLane(n, ww, i + 8 * w); - this.S[21] ^= this.toLane(n, ww, i + 9 * w); - this.S[ 2] ^= this.toLane(n, ww, i + 10 * w); - this.S[ 7] ^= this.toLane(n, ww, i + 11 * w); - this.S[12] ^= this.toLane(n, ww, i + 12 * w); - this.S[17] ^= this.toLane(n, ww, i + 13 * w); - this.S[22] ^= this.toLane(n, ww, i + 14 * w); - this.S[ 3] ^= this.toLane(n, ww, i + 15 * w); - this.S[ 8] ^= this.toLane(n, ww, i + 16 * w); - this.S[13] ^= this.toLane(n, ww, i + 17 * w); - this.S[18] ^= this.toLane(n, ww, i + 18 * w); - this.S[23] ^= this.toLane(n, ww, i + 19 * w); - this.S[ 4] ^= this.toLane(n, ww, i + 20 * w); - this.S[ 9] ^= this.toLane(n, ww, i + 21 * w); - this.S[14] ^= this.toLane(n, ww, i + 22 * w); - this.S[19] ^= this.toLane(n, ww, i + 23 * w); - this.S[24] ^= this.toLane(n, ww, i + 24 * w); + this.S[ 0] ^= this.toLane(n, ww, i + 0 ); + this.S[ 5] ^= this.toLane(n, ww, i + ww); + this.S[10] ^= this.toLane(n, ww, i + 2 * ww); + this.S[15] ^= this.toLane(n, ww, i + 3 * ww); + this.S[20] ^= this.toLane(n, ww, i + 4 * ww); + this.S[ 1] ^= this.toLane(n, ww, i + 5 * ww); + this.S[ 6] ^= this.toLane(n, ww, i + 6 * ww); + this.S[11] ^= this.toLane(n, ww, i + 7 * ww); + this.S[16] ^= this.toLane(n, ww, i + 8 * ww); + this.S[21] ^= this.toLane(n, ww, i + 9 * ww); + this.S[ 2] ^= this.toLane(n, ww, i + 10 * ww); + this.S[ 7] ^= this.toLane(n, ww, i + 11 * ww); + this.S[12] ^= this.toLane(n, ww, i + 12 * ww); + this.S[17] ^= this.toLane(n, ww, i + 13 * ww); + this.S[22] ^= this.toLane(n, ww, i + 14 * ww); + this.S[ 3] ^= this.toLane(n, ww, i + 15 * ww); + this.S[ 8] ^= this.toLane(n, ww, i + 16 * ww); + this.S[13] ^= this.toLane(n, ww, i + 17 * ww); + this.S[18] ^= this.toLane(n, ww, i + 18 * ww); + this.S[23] ^= this.toLane(n, ww, i + 19 * ww); + this.S[ 4] ^= this.toLane(n, ww, i + 20 * ww); + this.S[ 9] ^= this.toLane(n, ww, i + 21 * ww); + this.S[14] ^= this.toLane(n, ww, i + 22 * ww); + this.S[19] ^= this.toLane(n, ww, i + 23 * ww); + this.S[24] ^= this.toLane(n, ww, i + 24 * ww); this.keccakF(this.S); n += rr; } @@ -795,31 +795,31 @@ public class ConcurrentSHA3 else for (int i = 0; i < len; i += rr) { - this.S[ 0] ^= this.toLane(n, ww, i + 0 ); - this.S[ 5] ^= this.toLane(n, ww, i + w); - this.S[10] ^= this.toLane(n, ww, i + 2 * w); - this.S[15] ^= this.toLane(n, ww, i + 3 * w); - this.S[20] ^= this.toLane(n, ww, i + 4 * w); - this.S[ 1] ^= this.toLane(n, ww, i + 5 * w); - this.S[ 6] ^= this.toLane(n, ww, i + 6 * w); - this.S[11] ^= this.toLane(n, ww, i + 7 * w); - this.S[16] ^= this.toLane(n, ww, i + 8 * w); - this.S[21] ^= this.toLane(n, ww, i + 9 * w); - this.S[ 2] ^= this.toLane(n, ww, i + 10 * w); - this.S[ 7] ^= this.toLane(n, ww, i + 11 * w); - this.S[12] ^= this.toLane(n, ww, i + 12 * w); - this.S[17] ^= this.toLane(n, ww, i + 13 * w); - this.S[22] ^= this.toLane(n, ww, i + 14 * w); - this.S[ 3] ^= this.toLane(n, ww, i + 15 * w); - this.S[ 8] ^= this.toLane(n, ww, i + 16 * w); - this.S[13] ^= this.toLane(n, ww, i + 17 * w); - this.S[18] ^= this.toLane(n, ww, i + 18 * w); - this.S[23] ^= this.toLane(n, ww, i + 19 * w); - this.S[ 4] ^= this.toLane(n, ww, i + 20 * w); - this.S[ 9] ^= this.toLane(n, ww, i + 21 * w); - this.S[14] ^= this.toLane(n, ww, i + 22 * w); - this.S[19] ^= this.toLane(n, ww, i + 23 * w); - this.S[24] ^= this.toLane(n, ww, i + 24 * w); + this.S[ 0] ^= this.toLane(n, ww, i + 0 ); + this.S[ 5] ^= this.toLane(n, ww, i + ww); + this.S[10] ^= this.toLane(n, ww, i + 2 * ww); + this.S[15] ^= this.toLane(n, ww, i + 3 * ww); + this.S[20] ^= this.toLane(n, ww, i + 4 * ww); + this.S[ 1] ^= this.toLane(n, ww, i + 5 * ww); + this.S[ 6] ^= this.toLane(n, ww, i + 6 * ww); + this.S[11] ^= this.toLane(n, ww, i + 7 * ww); + this.S[16] ^= this.toLane(n, ww, i + 8 * ww); + this.S[21] ^= this.toLane(n, ww, i + 9 * ww); + this.S[ 2] ^= this.toLane(n, ww, i + 10 * ww); + this.S[ 7] ^= this.toLane(n, ww, i + 11 * ww); + this.S[12] ^= this.toLane(n, ww, i + 12 * ww); + this.S[17] ^= this.toLane(n, ww, i + 13 * ww); + this.S[22] ^= this.toLane(n, ww, i + 14 * ww); + this.S[ 3] ^= this.toLane(n, ww, i + 15 * ww); + this.S[ 8] ^= this.toLane(n, ww, i + 16 * ww); + this.S[13] ^= this.toLane(n, ww, i + 17 * ww); + this.S[18] ^= this.toLane(n, ww, i + 18 * ww); + this.S[23] ^= this.toLane(n, ww, i + 19 * ww); + this.S[ 4] ^= this.toLane(n, ww, i + 20 * ww); + this.S[ 9] ^= this.toLane(n, ww, i + 21 * ww); + this.S[14] ^= this.toLane(n, ww, i + 22 * ww); + this.S[19] ^= this.toLane(n, ww, i + 23 * ww); + this.S[24] ^= this.toLane(n, ww, i + 24 * ww); this.keccakF(this.S); n += rr; } diff --git a/java/SHA3.java b/java/SHA3.java index 8ab9a51..fa70915 100644 --- a/java/SHA3.java +++ b/java/SHA3.java @@ -477,31 +477,31 @@ public class SHA3 else for (int i = 0; i < len; i += rr) { - SHA3.S[ 0] ^= SHA3.toLane(n, ww, i + 0 ); - SHA3.S[ 5] ^= SHA3.toLane(n, ww, i + w); - SHA3.S[10] ^= SHA3.toLane(n, ww, i + 2 * w); - SHA3.S[15] ^= SHA3.toLane(n, ww, i + 3 * w); - SHA3.S[20] ^= SHA3.toLane(n, ww, i + 4 * w); - SHA3.S[ 1] ^= SHA3.toLane(n, ww, i + 5 * w); - SHA3.S[ 6] ^= SHA3.toLane(n, ww, i + 6 * w); - SHA3.S[11] ^= SHA3.toLane(n, ww, i + 7 * w); - SHA3.S[16] ^= SHA3.toLane(n, ww, i + 8 * w); - SHA3.S[21] ^= SHA3.toLane(n, ww, i + 9 * w); - SHA3.S[ 2] ^= SHA3.toLane(n, ww, i + 10 * w); - SHA3.S[ 7] ^= SHA3.toLane(n, ww, i + 11 * w); - SHA3.S[12] ^= SHA3.toLane(n, ww, i + 12 * w); - SHA3.S[17] ^= SHA3.toLane(n, ww, i + 13 * w); - SHA3.S[22] ^= SHA3.toLane(n, ww, i + 14 * w); - SHA3.S[ 3] ^= SHA3.toLane(n, ww, i + 15 * w); - SHA3.S[ 8] ^= SHA3.toLane(n, ww, i + 16 * w); - SHA3.S[13] ^= SHA3.toLane(n, ww, i + 17 * w); - SHA3.S[18] ^= SHA3.toLane(n, ww, i + 18 * w); - SHA3.S[23] ^= SHA3.toLane(n, ww, i + 19 * w); - SHA3.S[ 4] ^= SHA3.toLane(n, ww, i + 20 * w); - SHA3.S[ 9] ^= SHA3.toLane(n, ww, i + 21 * w); - SHA3.S[14] ^= SHA3.toLane(n, ww, i + 22 * w); - SHA3.S[19] ^= SHA3.toLane(n, ww, i + 23 * w); - SHA3.S[24] ^= SHA3.toLane(n, ww, i + 24 * w); + SHA3.S[ 0] ^= SHA3.toLane(n, ww, i + 0 ); + SHA3.S[ 5] ^= SHA3.toLane(n, ww, i + ww); + SHA3.S[10] ^= SHA3.toLane(n, ww, i + 2 * ww); + SHA3.S[15] ^= SHA3.toLane(n, ww, i + 3 * ww); + SHA3.S[20] ^= SHA3.toLane(n, ww, i + 4 * ww); + SHA3.S[ 1] ^= SHA3.toLane(n, ww, i + 5 * ww); + SHA3.S[ 6] ^= SHA3.toLane(n, ww, i + 6 * ww); + SHA3.S[11] ^= SHA3.toLane(n, ww, i + 7 * ww); + SHA3.S[16] ^= SHA3.toLane(n, ww, i + 8 * ww); + SHA3.S[21] ^= SHA3.toLane(n, ww, i + 9 * ww); + SHA3.S[ 2] ^= SHA3.toLane(n, ww, i + 10 * ww); + SHA3.S[ 7] ^= SHA3.toLane(n, ww, i + 11 * ww); + SHA3.S[12] ^= SHA3.toLane(n, ww, i + 12 * ww); + SHA3.S[17] ^= SHA3.toLane(n, ww, i + 13 * ww); + SHA3.S[22] ^= SHA3.toLane(n, ww, i + 14 * ww); + SHA3.S[ 3] ^= SHA3.toLane(n, ww, i + 15 * ww); + SHA3.S[ 8] ^= SHA3.toLane(n, ww, i + 16 * ww); + SHA3.S[13] ^= SHA3.toLane(n, ww, i + 17 * ww); + SHA3.S[18] ^= SHA3.toLane(n, ww, i + 18 * ww); + SHA3.S[23] ^= SHA3.toLane(n, ww, i + 19 * ww); + SHA3.S[ 4] ^= SHA3.toLane(n, ww, i + 20 * ww); + SHA3.S[ 9] ^= SHA3.toLane(n, ww, i + 21 * ww); + SHA3.S[14] ^= SHA3.toLane(n, ww, i + 22 * ww); + SHA3.S[19] ^= SHA3.toLane(n, ww, i + 23 * ww); + SHA3.S[24] ^= SHA3.toLane(n, ww, i + 24 * ww); SHA3.keccakF(SHA3.S); n += rr; } @@ -801,31 +801,31 @@ public class SHA3 else for (int i = 0; i < len; i += rr) { - SHA3.S[ 0] ^= SHA3.toLane(n, ww, i + 0 ); - SHA3.S[ 5] ^= SHA3.toLane(n, ww, i + w); - SHA3.S[10] ^= SHA3.toLane(n, ww, i + 2 * w); - SHA3.S[15] ^= SHA3.toLane(n, ww, i + 3 * w); - SHA3.S[20] ^= SHA3.toLane(n, ww, i + 4 * w); - SHA3.S[ 1] ^= SHA3.toLane(n, ww, i + 5 * w); - SHA3.S[ 6] ^= SHA3.toLane(n, ww, i + 6 * w); - SHA3.S[11] ^= SHA3.toLane(n, ww, i + 7 * w); - SHA3.S[16] ^= SHA3.toLane(n, ww, i + 8 * w); - SHA3.S[21] ^= SHA3.toLane(n, ww, i + 9 * w); - SHA3.S[ 2] ^= SHA3.toLane(n, ww, i + 10 * w); - SHA3.S[ 7] ^= SHA3.toLane(n, ww, i + 11 * w); - SHA3.S[12] ^= SHA3.toLane(n, ww, i + 12 * w); - SHA3.S[17] ^= SHA3.toLane(n, ww, i + 13 * w); - SHA3.S[22] ^= SHA3.toLane(n, ww, i + 14 * w); - SHA3.S[ 3] ^= SHA3.toLane(n, ww, i + 15 * w); - SHA3.S[ 8] ^= SHA3.toLane(n, ww, i + 16 * w); - SHA3.S[13] ^= SHA3.toLane(n, ww, i + 17 * w); - SHA3.S[18] ^= SHA3.toLane(n, ww, i + 18 * w); - SHA3.S[23] ^= SHA3.toLane(n, ww, i + 19 * w); - SHA3.S[ 4] ^= SHA3.toLane(n, ww, i + 20 * w); - SHA3.S[ 9] ^= SHA3.toLane(n, ww, i + 21 * w); - SHA3.S[14] ^= SHA3.toLane(n, ww, i + 22 * w); - SHA3.S[19] ^= SHA3.toLane(n, ww, i + 23 * w); - SHA3.S[24] ^= SHA3.toLane(n, ww, i + 24 * w); + SHA3.S[ 0] ^= SHA3.toLane(n, ww, i + 0 ); + SHA3.S[ 5] ^= SHA3.toLane(n, ww, i + ww); + SHA3.S[10] ^= SHA3.toLane(n, ww, i + 2 * ww); + SHA3.S[15] ^= SHA3.toLane(n, ww, i + 3 * ww); + SHA3.S[20] ^= SHA3.toLane(n, ww, i + 4 * ww); + SHA3.S[ 1] ^= SHA3.toLane(n, ww, i + 5 * ww); + SHA3.S[ 6] ^= SHA3.toLane(n, ww, i + 6 * ww); + SHA3.S[11] ^= SHA3.toLane(n, ww, i + 7 * ww); + SHA3.S[16] ^= SHA3.toLane(n, ww, i + 8 * ww); + SHA3.S[21] ^= SHA3.toLane(n, ww, i + 9 * ww); + SHA3.S[ 2] ^= SHA3.toLane(n, ww, i + 10 * ww); + SHA3.S[ 7] ^= SHA3.toLane(n, ww, i + 11 * ww); + SHA3.S[12] ^= SHA3.toLane(n, ww, i + 12 * ww); + SHA3.S[17] ^= SHA3.toLane(n, ww, i + 13 * ww); + SHA3.S[22] ^= SHA3.toLane(n, ww, i + 14 * ww); + SHA3.S[ 3] ^= SHA3.toLane(n, ww, i + 15 * ww); + SHA3.S[ 8] ^= SHA3.toLane(n, ww, i + 16 * ww); + SHA3.S[13] ^= SHA3.toLane(n, ww, i + 17 * ww); + SHA3.S[18] ^= SHA3.toLane(n, ww, i + 18 * ww); + SHA3.S[23] ^= SHA3.toLane(n, ww, i + 19 * ww); + SHA3.S[ 4] ^= SHA3.toLane(n, ww, i + 20 * ww); + SHA3.S[ 9] ^= SHA3.toLane(n, ww, i + 21 * ww); + SHA3.S[14] ^= SHA3.toLane(n, ww, i + 22 * ww); + SHA3.S[19] ^= SHA3.toLane(n, ww, i + 23 * ww); + SHA3.S[24] ^= SHA3.toLane(n, ww, i + 24 * ww); SHA3.keccakF(SHA3.S); n += rr; } |