diff --git a/xhash/DOC.md b/xhash/DOC.md new file mode 100644 index 0000000..caaaaab --- /dev/null +++ b/xhash/DOC.md @@ -0,0 +1,430 @@ + + +# xhash + +```go +import "github.com/fufuok/utils/xhash" +``` + +## Index + +- [func AddBytes32(h uint32, b []byte) uint32](<#func-addbytes32>) +- [func AddBytes64(h uint64, b []byte) uint64](<#func-addbytes64>) +- [func AddString32(h uint32, s string) uint32](<#func-addstring32>) +- [func AddString64(h uint64, s string) uint64](<#func-addstring64>) +- [func AddUint32(h, u uint32) uint32](<#func-adduint32>) +- [func AddUint64(h uint64, u uint64) uint64](<#func-adduint64>) +- [func Djb33(s string) uint32](<#func-djb33>) +- [func FnvHash(s string) uint64](<#func-fnvhash>) +- [func FnvHash32(s string) uint32](<#func-fnvhash32>) +- [func GenHasher[K comparable]() func(K) uintptr](<#func-genhasher>) +- [func GenHasher64[K comparable]() func(K) uint64](<#func-genhasher64>) +- [func GenSeedHasher64[K comparable]() func(maphash.Seed, K) uint64](<#func-genseedhasher64>) +- [func Hash(b []byte, h hash.Hash) []byte](<#func-hash>) +- [func HashBytes(b ...[]byte) string](<#func-hashbytes>) +- [func HashBytes32(b ...[]byte) uint32](<#func-hashbytes32>) +- [func HashBytes64(b ...[]byte) uint64](<#func-hashbytes64>) +- [func HashSeedString(seed maphash.Seed, s string) uint64](<#func-hashseedstring>) +- [func HashSeedUint64(seed maphash.Seed, n uint64) uint64](<#func-hashseeduint64>) +- [func HashString(s ...string) string](<#func-hashstring>) +- [func HashString32(s ...string) uint32](<#func-hashstring32>) +- [func HashString64(s ...string) uint64](<#func-hashstring64>) +- [func HashUint32(u uint32) uint32](<#func-hashuint32>) +- [func HashUint64(u uint64) uint64](<#func-hashuint64>) +- [func Hmac(b []byte, key []byte, h func() hash.Hash) []byte](<#func-hmac>) +- [func HmacSHA1(b, key []byte) []byte](<#func-hmacsha1>) +- [func HmacSHA1Hex(s, key string) string](<#func-hmacsha1hex>) +- [func HmacSHA256(b, key []byte) []byte](<#func-hmacsha256>) +- [func HmacSHA256Hex(s, key string) string](<#func-hmacsha256hex>) +- [func HmacSHA512(b, key []byte) []byte](<#func-hmacsha512>) +- [func HmacSHA512Hex(s, key string) string](<#func-hmacsha512hex>) +- [func MD5(b []byte) []byte](<#func-md5>) +- [func MD5BytesHex(bs []byte) string](<#func-md5byteshex>) +- [func MD5Hex(s string) string](<#func-md5hex>) +- [func MD5Reader(r io.Reader) (string, error)](<#func-md5reader>) +- [func MD5Sum(filename string) (string, error)](<#func-md5sum>) +- [func MemHash(s string) uint64](<#func-memhash>) +- [func MemHash32(s string) uint32](<#func-memhash32>) +- [func MemHashb(b []byte) uint64](<#func-memhashb>) +- [func MemHashb32(b []byte) uint32](<#func-memhashb32>) +- [func MustMD5Sum(filename string) string](<#func-mustmd5sum>) +- [func Sha1(b []byte) []byte](<#func-sha1>) +- [func Sha1Hex(s string) string](<#func-sha1hex>) +- [func Sha256(b []byte) []byte](<#func-sha256>) +- [func Sha256Hex(s string) string](<#func-sha256hex>) +- [func Sha512(b []byte) []byte](<#func-sha512>) +- [func Sha512Hex(s string) string](<#func-sha512hex>) +- [func Sum32(s string) uint32](<#func-sum32>) +- [func Sum64(s string) uint64](<#func-sum64>) +- [func SumBytes32(bs []byte) uint32](<#func-sumbytes32>) +- [func SumBytes64(bs []byte) uint64](<#func-sumbytes64>) +- [type Hashable](<#type-hashable>) + + +## func AddBytes32 + +```go +func AddBytes32(h uint32, b []byte) uint32 +``` + +AddBytes32 adds the hash of b to the precomputed hash value h. Ref: segmentio/fasthash + +## func AddBytes64 + +```go +func AddBytes64(h uint64, b []byte) uint64 +``` + +AddBytes64 adds the hash of b to the precomputed hash value h. Ref: segmentio/fasthash + +## func AddString32 + +```go +func AddString32(h uint32, s string) uint32 +``` + +AddString32 adds the hash of s to the precomputed hash value h. Ref: segmentio/fasthash + +## func AddString64 + +```go +func AddString64(h uint64, s string) uint64 +``` + +AddString64 adds the hash of s to the precomputed hash value h. Ref: segmentio/fasthash + +## func AddUint32 + +```go +func AddUint32(h, u uint32) uint32 +``` + +AddUint32 adds the hash value of the 8 bytes of u to h. Ref: segmentio/fasthash + +## func AddUint64 + +```go +func AddUint64(h uint64, u uint64) uint64 +``` + +AddUint64 adds the hash value of the 8 bytes of u to h. Ref: segmentio/fasthash + +## func Djb33 + +```go +func Djb33(s string) uint32 +``` + +Djb33 比 FnvHash32 更快的获取字符串哈希值 djb2 with better shuffling. 5x faster than FNV with the hash.Hash overhead. Ref: patrickmn/go\-cache + +## func FnvHash + +```go +func FnvHash(s string) uint64 +``` + +FnvHash 获取字符串的哈希值 + +## func FnvHash32 + +```go +func FnvHash32(s string) uint32 +``` + +FnvHash32 获取字符串的哈希值 + +## func GenHasher + +```go +func GenHasher[K comparable]() func(K) uintptr +``` + +## func GenHasher64 + +```go +func GenHasher64[K comparable]() func(K) uint64 +``` + +GenHasher64 返回哈希函数 Ref: smallnest/safemap, alphadose/haxmap, cornelk/hashmap + +## func GenSeedHasher64 + +```go +func GenSeedHasher64[K comparable]() func(maphash.Seed, K) uint64 +``` + +## func Hash + +```go +func Hash(b []byte, h hash.Hash) []byte +``` + +## func HashBytes + +```go +func HashBytes(b ...[]byte) string +``` + +HashBytes 合并 Bytes, 得到字符串哈希 + +## func HashBytes32 + +```go +func HashBytes32(b ...[]byte) uint32 +``` + +## func HashBytes64 + +```go +func HashBytes64(b ...[]byte) uint64 +``` + +## func HashSeedString + +```go +func HashSeedString(seed maphash.Seed, s string) uint64 +``` + +HashSeedString calculates a hash of s with the given seed. + +## func HashSeedUint64 + +```go +func HashSeedUint64(seed maphash.Seed, n uint64) uint64 +``` + +HashSeedUint64 calculates a hash of n with the given seed. + +## func HashString + +```go +func HashString(s ...string) string +``` + +HashString 合并一串文本, 得到字符串哈希 + +## func HashString32 + +```go +func HashString32(s ...string) uint32 +``` + +## func HashString64 + +```go +func HashString64(s ...string) uint64 +``` + +## func HashUint32 + +```go +func HashUint32(u uint32) uint32 +``` + +HashUint32 returns the hash of u. Ref: segmentio/fasthash + +## func HashUint64 + +```go +func HashUint64(u uint64) uint64 +``` + +HashUint64 returns the hash of u. Ref: segmentio/fasthash + +## func Hmac + +```go +func Hmac(b []byte, key []byte, h func() hash.Hash) []byte +``` + +## func HmacSHA1 + +```go +func HmacSHA1(b, key []byte) []byte +``` + +## func HmacSHA1Hex + +```go +func HmacSHA1Hex(s, key string) string +``` + +## func HmacSHA256 + +```go +func HmacSHA256(b, key []byte) []byte +``` + +## func HmacSHA256Hex + +```go +func HmacSHA256Hex(s, key string) string +``` + +## func HmacSHA512 + +```go +func HmacSHA512(b, key []byte) []byte +``` + +## func HmacSHA512Hex + +```go +func HmacSHA512Hex(s, key string) string +``` + +## func MD5 + +```go +func MD5(b []byte) []byte +``` + +## func MD5BytesHex + +```go +func MD5BytesHex(bs []byte) string +``` + +## func MD5Hex + +```go +func MD5Hex(s string) string +``` + +MD5Hex 字符串 MD5 + +## func MD5Reader + +```go +func MD5Reader(r io.Reader) (string, error) +``` + +MD5Reader 计算 MD5 + +## func MD5Sum + +```go +func MD5Sum(filename string) (string, error) +``` + +MD5Sum 文件 MD5 + +## func MemHash + +```go +func MemHash(s string) uint64 +``` + +MemHash 使用内置的 memhash 获取字符串哈希值 + +## func MemHash32 + +```go +func MemHash32(s string) uint32 +``` + +MemHash32 使用内置的 memhash 获取字符串哈希值 + +## func MemHashb + +```go +func MemHashb(b []byte) uint64 +``` + +MemHashb 使用内置的 memhash 获取哈希值 + +## func MemHashb32 + +```go +func MemHashb32(b []byte) uint32 +``` + +MemHashb32 使用内置的 memhash 获取哈希值 + +## func MustMD5Sum + +```go +func MustMD5Sum(filename string) string +``` + +## func Sha1 + +```go +func Sha1(b []byte) []byte +``` + +## func Sha1Hex + +```go +func Sha1Hex(s string) string +``` + +## func Sha256 + +```go +func Sha256(b []byte) []byte +``` + +## func Sha256Hex + +```go +func Sha256Hex(s string) string +``` + +## func Sha512 + +```go +func Sha512(b []byte) []byte +``` + +## func Sha512Hex + +```go +func Sha512Hex(s string) string +``` + +## func Sum32 + +```go +func Sum32(s string) uint32 +``` + +Sum32 获取字符串的哈希值 + +## func Sum64 + +```go +func Sum64(s string) uint64 +``` + +Sum64 获取字符串的哈希值 + +## func SumBytes32 + +```go +func SumBytes32(bs []byte) uint32 +``` + +SumBytes32 获取 bytes 的哈希值 + +## func SumBytes64 + +```go +func SumBytes64(bs []byte) uint64 +``` + +SumBytes64 获取 bytes 的哈希值 + +## type Hashable + +Hashable allowed map key types constraint + +```go +type Hashable interface { + // contains filtered or unexported methods +} +``` + + + +Generated by [gomarkdoc]()