From 1f17f92a16e0e7b499061ac0a0ffdcc1cf46e77e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 15 Feb 2013 21:38:22 +0100 Subject: support 8th bit in c version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'c') diff --git a/c/sha3.c b/c/sha3.c index 8e3f44d..d8981ed 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -365,7 +365,7 @@ inline llong toLane(byte* message, long msglen, long rr, long ww, long off) llong rc = 0; long n = min(msglen, rr), i; for (i = off + ww - 1; i >= off; i--) - rc = (rc << 8) | ((i < n) ? (llong)(message[i]) : 0L); + rc = (rc << 8) | ((i < n) ? (llong)(message[i] & 255) : 0L); return rc; } @@ -382,14 +382,14 @@ inline llong toLane(byte* message, long msglen, long rr, long ww, long off) inline llong toLane64(byte* message, long msglen, long rr, long off) { long n = min(msglen, rr); - return ((off + 7 < n) ? ((llong)(message[off + 7]) << 56) : 0L) | - ((off + 6 < n) ? ((llong)(message[off + 6]) << 48) : 0L) | - ((off + 5 < n) ? ((llong)(message[off + 5]) << 40) : 0L) | - ((off + 4 < n) ? ((llong)(message[off + 4]) << 32) : 0L) | - ((off + 3 < n) ? ((llong)(message[off + 3]) << 24) : 0L) | - ((off + 2 < n) ? ((llong)(message[off + 2]) << 16) : 0L) | - ((off + 1 < n) ? ((llong)(message[off + 1]) << 8) : 0L) | - ((off < n) ? ((llong)(message[off ]) ) : 0L); + return ((off + 7 < n) ? ((llong)(message[off + 7] & 255) << 56) : 0L) | + ((off + 6 < n) ? ((llong)(message[off + 6] & 255) << 48) : 0L) | + ((off + 5 < n) ? ((llong)(message[off + 5] & 255) << 40) : 0L) | + ((off + 4 < n) ? ((llong)(message[off + 4] & 255) << 32) : 0L) | + ((off + 3 < n) ? ((llong)(message[off + 3] & 255) << 24) : 0L) | + ((off + 2 < n) ? ((llong)(message[off + 2] & 255) << 16) : 0L) | + ((off + 1 < n) ? ((llong)(message[off + 1] & 255) << 8) : 0L) | + ((off < n) ? ((llong)(message[off ] & 255) ) : 0L); } -- cgit v1.2.3-70-g09d2