From 96c39f0c265413f792da550f6ddaf514ece8c954 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 4 Feb 2013 23:41:18 +0100 Subject: m + twist at squeeze in java MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- SHA3.java | 6 ++---- sha3sum.py | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/SHA3.java b/SHA3.java index 8db88c4..f9b9594 100644 --- a/SHA3.java +++ b/SHA3.java @@ -458,8 +458,7 @@ public class SHA3 if (SHA3.mptr + msglen > SHA3.M.length) System.arraycopy(SHA3.M, 0, SHA3.M = new byte[(SHA3.M.length + msglen) << 1], 0, SHA3.mptr); System.arraycopy(msg, 0, SHA3.M, SHA3.mptr, msglen); - SHA3.mptr += msglen; - int len = SHA3.mptr; + int len = SHA3.mptr += msglen; len -= len % ((SHA3.r * SHA3.b) >> 3); byte[] message; System.arraycopy(SHA3.M, 0, message = new byte[len], 0, len); @@ -647,7 +646,7 @@ public class SHA3 int i = 0; while ((i < ni) && (j < nn)) { - long v = SHA3.S[i]; + long v = SHA3.S[(i % 5) * 5 + i / 5]; for (int _ = 0; _ < ww; _++) { if (j < nn) @@ -668,4 +667,3 @@ public class SHA3 } } - diff --git a/sha3sum.py b/sha3sum.py index c508254..f7e297a 100755 --- a/sha3sum.py +++ b/sha3sum.py @@ -532,7 +532,7 @@ class SHA3: while (olen > 0): i = 0 while (i < ni) and (j < nn): - v = SHA3.S[(i % 5) * 5 + i // 5] # FIXME + v = SHA3.S[(i % 5) * 5 + i // 5] for _ in range(ww): if (j < nn): rc[ptr] = v & 255 -- cgit v1.2.3-70-g09d2