hash

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: MIT Imports: 2 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(c bool) uint32

Bool returns the hash of the given boolean.

func BoolSlice

func BoolSlice(S []bool) uint32

BoolSlice returns the hash of the given slice.

func Byte

func Byte(c byte) uint32

Byte returns the hash of the given byte.

func ByteSlice

func ByteSlice(S []byte) uint32

ByteSlice returns the hash of the given slice.

func Combine

func Combine(h1 uint32, h2 uint32) uint32

Combine returns a new hash value given by combining h1 and h2.

func Float32

func Float32(f float32) uint32

Float32 returns the hash of the given float.

func Float32Slice

func Float32Slice(S []float32) uint32

Float32Slice returns the hash of the given slice.

func Float64

func Float64(f float64) uint32

Float64 returns the hash of the given float.

func Float64Slice

func Float64Slice(S []float64) uint32

Float64Slice returns the hash of the given slice.

func Int

func Int(c int) uint32

Int returns the hash of the given integer.

func Int16

func Int16(c int16) uint32

Int16 returns the hash of the given integer.

func Int16Slice

func Int16Slice(S []int16) uint32

Int16Slice returns the hash of the given slice.

func Int32

func Int32(c int32) uint32

Int32 returns the hash of the given integer.

func Int32Slice

func Int32Slice(S []int32) uint32

Int32Slice returns the hash of the given slice.

func Int64

func Int64(c int64) uint32

Int64 returns the hash of the given integer.

func Int64Slice

func Int64Slice(S []int64) uint32

Int64Slice returns the hash of the given slice.

func Int8

func Int8(c int8) uint32

Int8 returns the hash of the given integer.

func Int8Slice

func Int8Slice(S []int8) uint32

Int8Slice returns the hash of the given slice.

func IntSlice

func IntSlice(S []int) uint32

IntSlice returns the hash of the given slice.

func Reuse

func Reuse(h *Hash)

Reuse returns the given Hash to the pool ready for future use.

func String

func String(s string) uint32

String returns the hash of the given string.

func StringSlice

func StringSlice(S []string) uint32

StringSlice returns the hash of the given slice.

func Uint

func Uint(c uint) uint32

Uint returns the hash of the given unsigned integer.

func Uint16

func Uint16(c uint16) uint32

Uint16 returns the hash of the given unsigned integer.

func Uint16Slice

func Uint16Slice(S []uint16) uint32

Uint16Slice returns the hash of the given slice.

func Uint32

func Uint32(c uint32) uint32

Uint32 returns the hash of the given unsigned integer.

func Uint32Slice

func Uint32Slice(S []uint32) uint32

Uint32Slice returns the hash of the given slice.

func Uint64

func Uint64(c uint64) uint32

Uint64 returns the hash of the given unsigned integer.

func Uint64Slice

func Uint64Slice(S []uint64) uint32

Uint64Slice returns the hash of the given slice.

func Uint8

func Uint8(c uint8) uint32

Uint8 returns the hash of the given unsigned integer.

func Uint8Slice

func Uint8Slice(S []uint8) uint32

Uint8Slice returns the hash of the given slice.

func UintSlice

func UintSlice(S []uint) uint32

UintSlice returns the hash of the given slice.

Types

type Hash

type Hash struct {
	// contains filtered or unexported fields
}

Hash defines a hasher. A zero-valued Hash is ready for use. Note that this is NOT intended for cryptographic use.

func New

func New() *Hash

New returns a new Hash from the pool ready for use.

func (*Hash) BlockSize

func (*Hash) BlockSize() int

BlockSize is irrelevant for a Hash. This is implemented purely to satisfy the hash.Hash interface, and will always return 512.

func (*Hash) Hash

func (h *Hash) Hash() uint32

Hash returns the current hash value.

func (*Hash) Reset

func (h *Hash) Reset()

Reset resets the Hash to its initial state.

func (*Hash) Size

func (*Hash) Size() int

Size returns the number of bytes Sum will return, which is 4.

func (*Hash) Sum

func (h *Hash) Sum(b []byte) []byte

Sum appends the current hash to b and returns the resulting slice. It does not change the underlying hash state.

func (*Hash) Sum32

func (h *Hash) Sum32() uint32

Sum32 returns the current hash value.

func (*Hash) Write

func (h *Hash) Write(b []byte) (int, error)

Write appends the given bytes to the hash. Write never returns an error.

Jump to

Keyboard shortcuts

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