[PATCH 10/12] random pt3: Simplify hash folding
From: Matt Mackall
Date: Wed Jan 19 2005 - 03:28:51 EST
Simplify output hash folding
Signed-off-by: Matt Mackall <mpm@xxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/