aboutsummaryrefslogtreecommitdiff
path: root/siphash24.c
diff options
context:
space:
mode:
authorJP Aumasson <jeanphilippe.aumasson@gmail.com>2014-11-08 18:43:13 +0100
committerJP Aumasson <jeanphilippe.aumasson@gmail.com>2014-11-08 18:43:13 +0100
commitbd07457f3410fa8086bcd7f7fa4d226b6152e210 (patch)
tree3df02574147b7b13195bbda20e0b0a34f2bbcb46 /siphash24.c
parentip statement (diff)
downloadsiphash-bd07457f3410fa8086bcd7f7fa4d226b6152e210.tar.gz
siphash-bd07457f3410fa8086bcd7f7fa4d226b6152e210.tar.xz
experimental 128-bit mode
Diffstat (limited to 'siphash24.c')
-rw-r--r--siphash24.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/siphash24.c b/siphash24.c
index a260dcb..350433f 100644
--- a/siphash24.c
+++ b/siphash24.c
@@ -70,6 +70,10 @@ int siphash( unsigned char *out, const unsigned char *in, unsigned long long in
v1 ^= k1;
v0 ^= k0;
+#ifdef DOUBLE
+ v1 ^= 0xee;
+#endif
+
for ( ; in != end; in += 8 )
{
m = U8TO64_LE( in );
@@ -124,12 +128,27 @@ int siphash( unsigned char *out, const unsigned char *in, unsigned long long in
printf( "(%3d) v2 %08x %08x\n", ( int )inlen, ( u32 )( v2 >> 32 ), ( u32 )v2 );
printf( "(%3d) v3 %08x %08x\n", ( int )inlen, ( u32 )( v3 >> 32 ), ( u32 )v3 );
#endif
+
+#ifndef DOUBLE
v2 ^= 0xff;
+#else
+ v2 ^= 0xee;
+#endif
for( i=0; i<dROUNDS; ++i ) SIPROUND;
b = v0 ^ v1 ^ v2 ^ v3;
U64TO8_LE( out, b );
+
+#ifdef DOUBLE
+ v1 ^= 0xdd;
+
+ for( i=0; i<dROUNDS; ++i ) SIPROUND;
+
+ b = v0 ^ v1 ^ v2 ^ v3;
+ U64TO8_LE( out+8, b );
+#endif
+
return 0;
}