mirror of
https://github.com/fluencelabs/tendermint
synced 2025-04-25 14:52:17 +00:00
24 lines
393 B
Go
24 lines
393 B
Go
|
package tmhash_test
|
||
|
|
||
|
import (
|
||
|
"crypto/sha256"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"github.com/tendermint/go-crypto/tmhash"
|
||
|
)
|
||
|
|
||
|
func TestHash(t *testing.T) {
|
||
|
testVector := []byte("abc")
|
||
|
hasher := tmhash.New()
|
||
|
hasher.Write(testVector)
|
||
|
bz := hasher.Sum(nil)
|
||
|
|
||
|
hasher = sha256.New()
|
||
|
hasher.Write(testVector)
|
||
|
bz2 := hasher.Sum(nil)
|
||
|
bz2 = bz2[:20]
|
||
|
|
||
|
assert.Equal(t, bz, bz2)
|
||
|
}
|