mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 08:32:40 +08:00
29 lines
577 B
Go
29 lines
577 B
Go
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")))
|
|
}
|