You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
401 B

  1. package tmhash_test
  2. import (
  3. "crypto/sha256"
  4. "testing"
  5. "github.com/stretchr/testify/assert"
  6. "github.com/tendermint/tendermint/crypto/tmhash"
  7. )
  8. func TestHash(t *testing.T) {
  9. testVector := []byte("abc")
  10. hasher := tmhash.New()
  11. hasher.Write(testVector)
  12. bz := hasher.Sum(nil)
  13. hasher = sha256.New()
  14. hasher.Write(testVector)
  15. bz2 := hasher.Sum(nil)
  16. bz2 = bz2[:20]
  17. assert.Equal(t, bz, bz2)
  18. }