aboutsummaryrefslogtreecommitdiffstats
path: root/c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-05 12:02:13 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-05 12:02:13 +0100
commit381caa2c8a80aee46c834c61f98e1165a6da25c8 (patch)
tree876b316a00ce7e8817ceea4e605b033f0f72cf4f /c
parentsome more porting to c (diff)
downloadsha3sum-381caa2c8a80aee46c834c61f98e1165a6da25c8.tar.gz
sha3sum-381caa2c8a80aee46c834c61f98e1165a6da25c8.tar.bz2
sha3sum-381caa2c8a80aee46c834c61f98e1165a6da25c8.tar.xz
ported lib but untested
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'c')
-rw-r--r--c/sha3.c6
1 files 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)