MCPcopy Create free account
hub / github.com/tendermint/tendermint / TestHash

Function TestHash

crypto/tmhash/hash_test.go:13–29  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestHash(t *testing.T) {
14 testVector := []byte("abc")
15 hasher := tmhash.New()
16 _, err := hasher.Write(testVector)
17 require.NoError(t, err)
18 bz := hasher.Sum(nil)
19
20 bz2 := tmhash.Sum(testVector)
21
22 hasher = sha256.New()
23 _, err = hasher.Write(testVector)
24 require.NoError(t, err)
25 bz3 := hasher.Sum(nil)
26
27 assert.Equal(t, bz, bz2)
28 assert.Equal(t, bz, bz3)
29}
30
31func TestHashTruncated(t *testing.T) {
32 testVector := []byte("abc")

Callers

nothing calls this directly

Calls 5

NewFunction · 0.92
SumFunction · 0.92
SumMethod · 0.80
WriteMethod · 0.65
EqualMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…