From ef91bd59e2befdb4be7321593fe8dc8f1250080e Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Wed, 2 Mar 2011 22:03:11 -0500 Subject: sha256_4way: skip last 3 rounds. Pointed out by several people, including Raulo. --- sha256_4way.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sha256_4way.c b/sha256_4way.c index 2c5afd8..742682f 100644 --- a/sha256_4way.c +++ b/sha256_4way.c @@ -452,12 +452,16 @@ static void DoubleBlockSHA256(const void* pin, void* pad, const void *pre, unsig SHA256ROUND(f, g, h, a, b, c, d, e, 59, w11); w12 = add4(SIGMA1_256(w10), w5, SIGMA0_256(w13), w12); SHA256ROUND(e, f, g, h, a, b, c, d, 60, w12); + + /* Skip last 3-rounds; not necessary for H==0 */ +#if 0 w13 = add4(SIGMA1_256(w11), w6, SIGMA0_256(w14), w13); SHA256ROUND(d, e, f, g, h, a, b, c, 61, w13); w14 = add4(SIGMA1_256(w12), w7, SIGMA0_256(w15), w14); SHA256ROUND(c, d, e, f, g, h, a, b, 62, w14); w15 = add4(SIGMA1_256(w13), w8, SIGMA0_256(w0), w15); SHA256ROUND(b, c, d, e, f, g, h, a, 63, w15); +#endif /* store resulsts directly in thash */ #define store_2(x,i) \ -- cgit v1.2.3-18-g5258