[Pkg-privacy-commits] [golang-siphash-dev] 07/23: Reorder round function operations for readability.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 12:55:52 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository golang-siphash-dev.

commit 249337cd78d80f98f4187d4507ac3f5bb88bbea0
Author: Dmitry Chestnykh <dmitry at codingrobots.com>
Date:   Thu Jun 21 15:35:22 2012 +0200

    Reorder round function operations for readability.
---
 siphash.go | 26 ++++++++++++++------------
 1 file changed, 14 insertions(+), 12 deletions(-)

diff --git a/siphash.go b/siphash.go
index 15579e3..c395c85 100644
--- a/siphash.go
+++ b/siphash.go
@@ -64,20 +64,21 @@ func block(d *digest, p []uint8) {
 		v3 ^= m
 		for i := 0; i < CRounds; i++ {
 			v0 += v1
-			v2 += v3
 			v1 = v1<<13 | v1>>(64-13)
-			v3 = v3<<16 | v3>>(64-16)
 			v1 ^= v0
-			v3 ^= v2
 			v0 = v0<<32 | v0>>(64-32)
 
-			v2 += v1
+			v2 += v3
+			v3 = v3<<16 | v3>>(64-16)
+			v3 ^= v2
+
 			v0 += v3
-			v1 = v1<<17 | v1>>(64-17)
 			v3 = v3<<21 | v3>>(64-21)
+			v3 ^= v0
 
+			v2 += v1
+			v1 = v1<<17 | v1>>(64-17)
 			v1 ^= v2
-			v3 ^= v0
 			v2 = v2<<32 | v2>>(64-32)
 		}
 		v0 ^= m
@@ -127,20 +128,21 @@ func (d0 *digest) Sum64() uint64 {
 	v2 ^= 0xff
 	for i := 0; i < DRounds; i++ {
 		v0 += v1
-		v2 += v3
 		v1 = v1<<13 | v1>>(64-13)
-		v3 = v3<<16 | v3>>(64-16)
 		v1 ^= v0
-		v3 ^= v2
 		v0 = v0<<32 | v0>>(64-32)
 
-		v2 += v1
+		v2 += v3
+		v3 = v3<<16 | v3>>(64-16)
+		v3 ^= v2
+
 		v0 += v3
-		v1 = v1<<17 | v1>>(64-17)
 		v3 = v3<<21 | v3>>(64-21)
+		v3 ^= v0
 
+		v2 += v1
+		v1 = v1<<17 | v1>>(64-17)
 		v1 ^= v2
-		v3 ^= v0
 		v2 = v2<<32 | v2>>(64-32)
 	}
 	return v0 ^ v1 ^ v2 ^ v3

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/golang-siphash-dev.git



More information about the Pkg-privacy-commits mailing list