From 381caa2c8a80aee46c834c61f98e1165a6da25c8 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Tue, 5 Feb 2013 12:02:13 +0100 Subject: ported lib but untested MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/c/sha3.c b/c/sha3.c index d854b2d..be2adf5 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -34,7 +34,8 @@ #define min(X, Y) ((X) < (Y) ? (X) : (Y)) -#define arraycopy(src, soff, dest, doff, lenght) {long copyi; for (copyi = 0; copyi < lenght; copyi++) dest[copyi + soff] = src[copyi + doff];} +#define arraycopy(src, soff, dest, doff, length) {long copyi; for (copyi = 0; copyi < length; copyi++) dest[copyi + soff] = src[copyi + doff];} +#define revarraycopy(src, soff, dest, doff, length) {long copyi; for (copyi = length - 1; copyi >= 0; copyi--) dest[copyi + soff] = src[copyi + doff];} @@ -411,7 +412,8 @@ extern void update(byte* msg, long msglen) len -= len % ((r * b) >> 3); message = (byte*)malloc(len); arraycopy(M, 0, message, 0, len); - System.arraycopy(M, len, M, 0, mptr -= len); + mptr -= len; + revarraycopy(M, len, M, 0, mptr); /* Absorbing phase */ if (ww == 8) -- cgit v1.2.3-70-g09d2