diff options
author | Mattias Andrée <maandree@operamail.com> | 2013-02-05 12:02:13 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2013-02-05 12:02:13 +0100 |
commit | 381caa2c8a80aee46c834c61f98e1165a6da25c8 (patch) | |
tree | 876b316a00ce7e8817ceea4e605b033f0f72cf4f | |
parent | some more porting to c (diff) | |
download | sha3sum-381caa2c8a80aee46c834c61f98e1165a6da25c8.tar.gz sha3sum-381caa2c8a80aee46c834c61f98e1165a6da25c8.tar.bz2 sha3sum-381caa2c8a80aee46c834c61f98e1165a6da25c8.tar.xz |
ported lib but untested
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r-- | c/sha3.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) |