From d0262422cc014d64b480197fd3961dd528ba6feb Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 11 Nov 2014 22:54:48 +0100 Subject: fix bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 4 ++-- java-c-jni/SHA3.c | 4 ++-- java/ConcurrentSHA3.java | 4 ++-- java/SHA3.java | 4 ++-- python2/sha3.py | 4 ++-- python3/sha3.py | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/c/sha3.c b/c/sha3.c index 996894c..50ba85b 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -787,7 +787,7 @@ byte* sha3_digest(byte* restrict_ msg, long msglen, long bits, char* restrict_ s olen = n; if (withReturn) { - ni = min(25, rr); + ni = rr / ww; while (olen > 0) { i = 0; @@ -865,7 +865,7 @@ byte* sha3_squeeze(void) rc = (byte*)malloc((nn = (n + 7) >> 3) * sizeof(byte)); olen = n; j = ptr = 0; - ni = (25 < r >> 3) ? 25 : (r >> 3); + ni = (r >> 3) / ww; while (olen > 0) { diff --git a/java-c-jni/SHA3.c b/java-c-jni/SHA3.c index e785406..76b1d61 100644 --- a/java-c-jni/SHA3.c +++ b/java-c-jni/SHA3.c @@ -723,7 +723,7 @@ byte* digest(byte* msg, long msglen, long bits, int* suffix, long suffix_len, bo olen = n; if (withReturn) { - ni = min(25, rr); + ni = rr / ww; while (olen > 0) { i = 0; @@ -801,7 +801,7 @@ byte* squeeze() rc = (byte*)malloc(nn = (n + 7) >> 3); olen = n; j = ptr = 0; - ni = (25 < r >> 3) ? 25 : (r >> 3); + ni = (r >> 3) / ww; while (olen > 0) { diff --git a/java/ConcurrentSHA3.java b/java/ConcurrentSHA3.java index 90569f8..69425b9 100644 --- a/java/ConcurrentSHA3.java +++ b/java/ConcurrentSHA3.java @@ -832,7 +832,7 @@ public class ConcurrentSHA3 int olen = this.n; int j = 0; - int ni = Math.min(25, rr); + int ni = rr / ww; while (olen > 0) { int i = 0; @@ -931,7 +931,7 @@ public class ConcurrentSHA3 int olen = this.n; int j = 0, ptr = 0; - int ni = Math.min(25, this.r >> 3); + int ni = (this.r >> 3) / ww; while (olen > 0) { int i = 0; diff --git a/java/SHA3.java b/java/SHA3.java index fa70915..9f41a00 100644 --- a/java/SHA3.java +++ b/java/SHA3.java @@ -838,7 +838,7 @@ public class SHA3 int olen = SHA3.n; int j = 0; - int ni = Math.min(25, rr); + int ni = rr / ww; while (olen > 0) { int i = 0; @@ -937,7 +937,7 @@ public class SHA3 int olen = SHA3.n; int j = 0, ptr = 0; - int ni = Math.min(25, SHA3.r >> 3); + int ni = (SHA3.r >> 3) / ww; while (olen > 0) { int i = 0; diff --git a/python2/sha3.py b/python2/sha3.py index a71f750..ecc3bc8 100644 --- a/python2/sha3.py +++ b/python2/sha3.py @@ -579,7 +579,7 @@ class SHA3: olen = self.n j = 0 - ni = min(25, rr) + ni = rr // ww while olen > 0: i = 0 while (i < ni) and (j < nn): @@ -644,7 +644,7 @@ class SHA3: olen = self.n j = 0 ptr = 0 - ni = min(25, self.r >> 3) + ni = (self.r >> 3) // ww while olen > 0: i = 0 diff --git a/python3/sha3.py b/python3/sha3.py index e1c10fa..639be46 100644 --- a/python3/sha3.py +++ b/python3/sha3.py @@ -572,7 +572,7 @@ class SHA3: olen = self.n j = 0 - ni = min(25, rr) + ni = rr // ww while olen > 0: i = 0 while (i < ni) and (j < nn): @@ -637,7 +637,7 @@ class SHA3: olen = self.n j = 0 ptr = 0 - ni = min(25, self.r >> 3) + ni = (self.r >> 3) // ww while olen > 0: i = 0 -- cgit v1.2.3-70-g09d2