1
0
mirror of https://github.com/charlienet/go-mixed.git synced 2025-07-18 00:22:41 +08:00
This commit is contained in:
2022-03-27 10:19:46 +08:00
parent aff81b33cd
commit 65194a74b1
2 changed files with 101 additions and 0 deletions

28
hash/hash_test.go Normal file
View File

@ -0,0 +1,28 @@
package hash_test
import (
"encoding/base64"
"encoding/hex"
"strconv"
"testing"
"github.com/charlienet/go-mixed/hash"
)
func TestEncode(t *testing.T) {
t.Log(base64.StdEncoding.EncodeToString(hash.Sha1([]byte{0x31})))
t.Log(hex.EncodeToString(hash.Sha1([]byte{0x31})))
}
func TestXXHash(t *testing.T) {
for i := 0; i < 10; i++ {
t.Log(hex.EncodeToString(hash.XXhash([]byte(strconv.Itoa(i)))), " ", hash.XXHashUint64([]byte(strconv.Itoa(i))))
}
}
func TestMurmur3(t *testing.T) {
t.Log(hash.Murmur3([]byte("123")))
t.Log(hash.XXHashUint64([]byte("123")))
}