[Pkg-privacy-commits] [golang-siphash-dev] 18/23: Also test Hash() with reference vectors.
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 12:55:54 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 7fa0da431ad98853f2282b4724fa1d3a69957ed5
Author: Dmitry Chestnykh <dmitry at codingrobots.com>
Date: Thu Jun 28 12:25:40 2012 +0200
Also test Hash() with reference vectors.
---
siphash_test.go | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/siphash_test.go b/siphash_test.go
index 0e933ff..5e01542 100644
--- a/siphash_test.go
+++ b/siphash_test.go
@@ -176,6 +176,22 @@ func TestHash(t *testing.T) {
t.Errorf(`%d: expected "%x", got "%x"`, i, v.r, sum)
}
}
+
+ var k [16]byte
+ var in [64]byte
+ for i := range k {
+ k[i] = byte(i)
+ }
+ k0 = binary.LittleEndian.Uint64(k[0:8])
+ k1 = binary.LittleEndian.Uint64(k[8:16])
+
+ for i := 0; i < 64; i++ {
+ in[i] = byte(i)
+ ref := binary.LittleEndian.Uint64(goldenRef[i])
+ if sum := Hash(k0, k1, in[:i]); sum != ref {
+ t.Errorf(`%d: expected "%x", got "%x"`, i, ref, sum)
+ }
+ }
}
var key = zeroKey
--
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