hash

package
v0.0.0-...-332b391 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 20, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(key uint64, buckets int32) int32

Hash consistently chooses a hash bucket number in the range [0, numBuckets) for the given key. numBuckets must be >= 1.

func HashString

func HashString(s string) uint64

HashString get a hash value of a string

func JumpConsistentHash

func JumpConsistentHash(len int, options ...interface{}) int

JumpConsistentHash selects a server by serviceMethod and args

func Md5Byte

func Md5Byte(s []byte) string

Md5Byte 获取字节数组md5值

func Md5File

func Md5File(path string) (string, error)

Md5File 文件md5值

func Md5String

func Md5String(s string) string

Md5String 获取字符串md5值

func Sha1Byte

func Sha1Byte(s []byte) string

Sha1Byte 获取节数组sha1值

func Sha1File

func Sha1File(path string) (string, error)

Sha1File 文件sha1值

func Sha1String

func Sha1String(s string) string

Sha1String 获取字符串sha1值

func Sha256Byte

func Sha256Byte(s []byte) string

Sha256Byte 获取节数组sha256值

func Sha256File

func Sha256File(path string) (string, error)

Sha256File 文件sha256值

func Sha256String

func Sha256String(s string) string

Sha256String 获取字符串sha256值

func Sha512Byte

func Sha512Byte(s []byte) string

Sha512Byte 获取节数组sha512值

func Sha512File

func Sha512File(path string) (string, error)

Sha512File 文件sha512值

func Sha512String

func Sha512String(s string) string

Sha512String 获取字符串sha512值

Types

type ConsistentAddrStrFunction

type ConsistentAddrStrFunction func(options ...interface{}) string

ConsistentFunction define a hash function Return service address, like "tcp@127.0.0.1:8970"

type HashServiceAndArgs

type HashServiceAndArgs func(len int, options ...interface{}) int

HashServiceAndArgs define a hash function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL