[Cryptech-Commits] [sw/libhal] 06/13: Fix coef4, which was swapping digits

git at cryptech.is git at cryptech.is
Fri Apr 20 01:06:13 UTC 2018


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch hashsig
in repository sw/libhal.

commit d5bd7787b214e0c10354c4cdabfcca92abd0aad6
Author: Paul Selkirk <paul at psgd.org>
AuthorDate: Sat Mar 10 08:10:12 2018 -0500

    Fix coef4, which was swapping digits
---
 hashsig.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/hashsig.c b/hashsig.c
index 13f20c6..e32358d 100644
--- a/hashsig.c
+++ b/hashsig.c
@@ -284,10 +284,7 @@ static uint8_t coef2(const uint8_t * const S, const size_t i)
 /* w = 4 */
 static uint8_t coef4(const uint8_t * const S, const size_t i)
 {
-    uint8_t byte = S[i/2];
-    if (i % 2)
-        byte >>= 4;
-    return byte & 0x0f;
+    return (S[i/2] >> (4 - (4 * (i % 2)))) & 0x0f;
 }
 
 /* w = 8 */



More information about the Commits mailing list