From 7ad82d0366a352055316c0e2de22dc9abdd292a4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 8 Feb 2013 06:31:13 +0100 Subject: corrected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- c/sha3.c | 11 +++++++++-- c/sha3sum.c | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) (limited to 'c') diff --git a/c/sha3.c b/c/sha3.c index 47867b8..a21a6a9 100644 --- a/c/sha3.c +++ b/c/sha3.c @@ -335,7 +335,7 @@ static byte* pad10star1(byte* msg, long len, long r, long* outlen) { byte* message; - long nrf = len >> 3; + long nrf = (len <<= 3) >> 3; long nbrf = len & 7; long ll = len % r; long i; @@ -382,7 +382,14 @@ extern void initialise(long bitrate, long capacity, long output) w = b / 25; l = lb(w); nr = 12 + (l << 1); - wmod = w == 64 ? -1LL ? (1LL << w) - 1LL; + if (w == 64) + wmod = -1; + else + { + wmod = 1; + wmod <<= w; + wmod--; + } S = (llong*)malloc(25 * sizeof(llong)); M = (byte*)malloc(mlen = (r * b) >> 2); mptr = 0; diff --git a/c/sha3sum.c b/c/sha3sum.c index 993cf94..bc29a58 100644 --- a/c/sha3sum.c +++ b/c/sha3sum.c @@ -338,13 +338,13 @@ int main(int argc, char** argv) if (binary) { long j; + for (j = 0; j < bn; j++) + putchar(*(bs + j)); if (filename == null) { stdin = bs; bs = null; } - for (j = 0; j < bn; j++) - putchar(*(bs + j)); fflush(stdout); } else -- cgit v1.2.3-70-g09d2