diff --git a/tz/digest.go b/tz/digest.go index e765f48..bcde95b 100644 --- a/tz/digest.go +++ b/tz/digest.go @@ -29,6 +29,7 @@ func New() *digest { // Sum returns Tillich-ZĂ©mor checksum of data. func Sum(data []byte) [Size]byte { d := new(digest) + d.Reset() _, _ = d.Write(data) // no errors return d.checkSum() } diff --git a/tz/hash_test.go b/tz/hash_test.go index 39fcfe6..7e5c609 100644 --- a/tz/hash_test.go +++ b/tz/hash_test.go @@ -151,6 +151,7 @@ func TestHomomorphism(t *testing.T) { // Test if our hashing is really homomorphic h = Sum(b) + require.NotEqual(t, [64]byte{}, h) h1 = Sum(b[:32]) h2 = Sum(b[32:])