mirror of
https://github.com/charlienet/go-mixed.git
synced 2025-07-18 00:22:41 +08:00
hash
This commit is contained in:
28
hash/hash_test.go
Normal file
28
hash/hash_test.go
Normal 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")))
|
||||
}
|
Reference in New Issue
Block a user