aboutsummaryrefslogtreecommitdiffstats
path: root/lfsr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lfsr.c')
-rw-r--r--lfsr.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/lfsr.c b/lfsr.c
new file mode 100644
index 0000000..664760a
--- /dev/null
+++ b/lfsr.c
@@ -0,0 +1,18 @@
+#include <linux/kernel.h>
+
+void mix_lfsr(u32 h[4], const u32 v[4])
+{
+ u32 w;
+ int i;
+
+ for (i = 0; i < 4; ++i) {
+ w = h[0] ^ h[1] ^ h[3] ^ v[i];
+ w ^= w << 17;
+ w ^= w >> 6;
+ w ^= w >> 9;
+ h[0] = h[1];
+ h[1] = h[2];
+ h[2] = h[3];
+ h[3] = w;
+ }
+}