From 5cee9b9c6394cffee6f31fab00323d9e559f0702 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 11 Feb 2019 17:56:37 +0100 Subject: General improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libkeccak_unhex.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libkeccak_unhex.c') diff --git a/libkeccak_unhex.c b/libkeccak_unhex.c index a12beb1..00bb039 100644 --- a/libkeccak_unhex.c +++ b/libkeccak_unhex.c @@ -15,6 +15,7 @@ libkeccak_unhex(void *restrict output_, const char *restrict hashsum) unsigned char *restrict output = output_; size_t n = strlen(hashsum) / 2; unsigned char a, b; + while (n--) { a = (unsigned char)hashsum[2 * n + 0]; b = (unsigned char)hashsum[2 * n + 1]; @@ -22,7 +23,7 @@ libkeccak_unhex(void *restrict output_, const char *restrict hashsum) a = (unsigned char)((a & 15) + (a > '9' ? 9 : 0)); b = (unsigned char)((b & 15) + (b > '9' ? 9 : 0)); - a <<= 4; + a = (unsigned char)(a << 4); a |= b; output[n] = a; } -- cgit v1.2.3-70-g09d2