aboutsummaryrefslogtreecommitdiffstats
path: root/spelvin.c
diff options
context:
space:
mode:
Diffstat (limited to 'spelvin.c')
-rw-r--r--spelvin.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/spelvin.c b/spelvin.c
new file mode 100644
index 0000000..a6f2100
--- /dev/null
+++ b/spelvin.c
@@ -0,0 +1,26 @@
+#include <linux/kernel.h>
+
+void mix_spelvin(u32 h[4], const u32 v[4])
+{
+ u32 a = h[0] ^ v[0], b = h[1] ^ v[1];
+ u32 c = h[2] ^ v[2], d = h[3] ^ v[3];
+
+ a += b; c += d;
+ b = rol32(b, 6); d = rol32(d, 27);
+ d ^= a; b ^= c;
+
+ a += b; c += d;
+ b = rol32(b, 16); d = rol32(d, 14);
+ d ^= a; b ^= c;
+
+ a += b; c += d;
+ b = rol32(b, 6); d = rol32(d, 27);
+ d ^= a; b ^= c;
+
+ a += b; c += d;
+ b = rol32(b, 16); d = rol32(d, 14);
+ d ^= a; b ^= c;
+
+ h[0] = a; h[1] = b;
+ h[2] = c; h[3] = d;
+}