aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP Aumasson <jeanphilippe.aumasson@gmail.com>2014-03-23 12:22:30 +0100
committerJP Aumasson <jeanphilippe.aumasson@gmail.com>2014-03-23 12:22:30 +0100
commitd39aafe4163d5137814281afd906fe63c64486fb (patch)
treeac6aa5a20871d3b935fdd70eb41aaf87bb6c299b
parentcode and readme (diff)
downloadsiphash-d39aafe4163d5137814281afd906fe63c64486fb.tar.gz
siphash-d39aafe4163d5137814281afd906fe63c64486fb.tar.xz
code formatting
-rw-r--r--main.c6
-rw-r--r--siphash24.c30
2 files changed, 21 insertions, 15 deletions
diff --git a/main.c b/main.c
index 7349517..28bc2de 100644
--- a/main.c
+++ b/main.c
@@ -1,7 +1,7 @@
/*
SipHash reference C implementation
- Written in 2012 by
+ Written in 2012 by
Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
Daniel J. Bernstein <djb@cr.yp.to>
@@ -20,7 +20,7 @@ typedef uint32_t u32;
typedef uint8_t u8;
extern int siphash( unsigned char *out, const unsigned char *in,
- unsigned long long inlen, const unsigned char *k );
+ unsigned long long inlen, const unsigned char *k );
/*
SipHash-2-4 output with
@@ -131,7 +131,7 @@ int main()
{
if ( test_vectors() )
printf( "test vectors ok\n" );
- else
+ else
printf( "test vectors fail\n" );
return 0;
diff --git a/siphash24.c b/siphash24.c
index 131033a..6ebe360 100644
--- a/siphash24.c
+++ b/siphash24.c
@@ -1,7 +1,7 @@
/*
SipHash reference C implementation
- Written in 2012 by
+ Written in 2012 by
Jean-Philippe Aumasson <jeanphilippe.aumasson@gmail.com>
Daniel J. Bernstein <djb@cr.yp.to>
@@ -82,27 +82,29 @@ int siphash( unsigned char *out, const unsigned char *in, unsigned long long in
printf( "(%3d) compress %08x %08x\n", ( int )inlen, ( u32 )( m >> 32 ), ( u32 )m );
#endif
v3 ^= m;
- for(i=0;i<cROUNDS;++i) SIPROUND;
+
+ for( i=0; i<cROUNDS; ++i ) SIPROUND;
+
v0 ^= m;
}
switch( left )
{
- case 7: b |= ( ( u64 )in[ 6] ) << 48;
+ case 7: b |= ( ( u64 )in[ 6] ) << 48;
- case 6: b |= ( ( u64 )in[ 5] ) << 40;
+ case 6: b |= ( ( u64 )in[ 5] ) << 40;
- case 5: b |= ( ( u64 )in[ 4] ) << 32;
+ case 5: b |= ( ( u64 )in[ 4] ) << 32;
- case 4: b |= ( ( u64 )in[ 3] ) << 24;
+ case 4: b |= ( ( u64 )in[ 3] ) << 24;
- case 3: b |= ( ( u64 )in[ 2] ) << 16;
+ case 3: b |= ( ( u64 )in[ 2] ) << 16;
- case 2: b |= ( ( u64 )in[ 1] ) << 8;
+ case 2: b |= ( ( u64 )in[ 1] ) << 8;
- case 1: b |= ( ( u64 )in[ 0] ); break;
+ case 1: b |= ( ( u64 )in[ 0] ); break;
- case 0: break;
+ case 0: break;
}
#ifdef DEBUG
@@ -113,7 +115,9 @@ int siphash( unsigned char *out, const unsigned char *in, unsigned long long in
printf( "(%3d) padding %08x %08x\n", ( int )inlen, ( u32 )( b >> 32 ), ( u32 )b );
#endif
v3 ^= b;
- for(i=0;i<cROUNDS;++i) SIPROUND;
+
+ for( i=0; i<cROUNDS; ++i ) SIPROUND;
+
v0 ^= b;
#ifdef DEBUG
printf( "(%3d) v0 %08x %08x\n", ( int )inlen, ( u32 )( v0 >> 32 ), ( u32 )v0 );
@@ -122,7 +126,9 @@ int siphash( unsigned char *out, const unsigned char *in, unsigned long long in
printf( "(%3d) v3 %08x %08x\n", ( int )inlen, ( u32 )( v3 >> 32 ), ( u32 )v3 );
#endif
v2 ^= 0xff;
- for(i=0;i<dROUNDS;++i) SIPROUND;
+
+ for( i=0; i<dROUNDS; ++i ) SIPROUND;
+
b = v0 ^ v1 ^ v2 ^ v3;
U64TO8_LE( out, b );
return 0;