lkml.org 
[lkml]   [2005]   [Jan]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 10/12] random pt3: Simplify hash folding
Date
Simplify output hash folding

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: rnd/drivers/char/random.c
===================================================================
--- rnd.orig/drivers/char/random.c 2005-01-18 10:42:17.993300522 -0800
+++ rnd/drivers/char/random.c 2005-01-18 10:42:39.078612373 -0800
@@ -1166,15 +1166,10 @@
* In case the hash function has some recognizable
* output pattern, we fold it in half.
*/
- for (i = 0; i < HASH_BUFFER_SIZE / 2; i++)
- buf[i] ^= buf[i + (HASH_BUFFER_SIZE + 1) / 2];

- if (HASH_BUFFER_SIZE & 1) {
- /* There's a middle word to deal with */
- x = buf[HASH_BUFFER_SIZE/2];
- x ^= (x >> 16); /* Fold it in half */
- ((__u16 *)buf)[HASH_BUFFER_SIZE - 1] = (__u16)x;
- }
+ buf[0] ^= buf[3];
+ buf[1] ^= buf[4];
+ buf[0] ^= rol32(buf[3], 16);
}

static ssize_t extract_entropy(struct entropy_store *r, void * buf,
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:09    [W:0.042 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site