From dffacacccf20712ee909b88e9714d7380bd9bd59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Fri, 11 Jul 2014 09:45:29 +0000 Subject: [PATCH] The spec says XOR here, not OR. Interestingly, it doesn't seem to make any difference. --- lib/digest/sha1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/digest/sha1.c b/lib/digest/sha1.c index e00157c..b503f02 100644 --- a/lib/digest/sha1.c +++ b/lib/digest/sha1.c @@ -87,11 +87,11 @@ sha1_compute(sha1_ctx *ctx, const uint8_t *block) e = ctx->h[4]; for (int t = 0; t < 80; ++t) { if (t < 20) - f = (b & c) | ((~b) & d); + f = (b & c) ^ ((~b) & d); else if (t < 40) f = b ^ c ^ d; else if (t < 60) - f = (b & c) | (b & d) | (c & d); + f = (b & c) ^ (b & d) ^ (c & d); else f = b ^ c ^ d; temp = rol(a, 5) + f + e + w[t] + sha1_k[t/20];