hash

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: CC0-1.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const Max = math.MaxUint32

Max defines the maximum size of a hash value.

Variables

This section is empty.

Functions

func ReuseSequenceHasher

func ReuseSequenceHasher(v *Sequence)

ReuseSequenceHasher returns the given sequential hash object to a pool ready for reuse by subsequent calls to NewSequenceHasher.

Types

type Hasher

type Hasher interface {
	Hash() Value // Hash returns a hash value for the object.
}

Hasher is the interface hashable objects should satisfy.

type Sequence

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

Sequence is a object allowing the cumulative hash value of a sequence of objects satisfying the Hasher interface to be calculated.

func NewSequenceHasher

func NewSequenceHasher() *Sequence

NewSequenceHasher returns a new sequential hash object. Once finished with this object, consider returning it to the pool for reuse.

func (*Sequence) Add

func (v *Sequence) Add(obj Hasher)

Add adds the given Hasher object to the cumulative hash value.

func (*Sequence) AddHash

func (v *Sequence) AddHash(h Value)

AddHash adds the given hash value to the cumulative hash value.

func (*Sequence) Hash

func (v *Sequence) Hash() Value

Hash returns the hash value computed so far.

func (*Sequence) Reset

func (v *Sequence) Reset()

Reset resets the cumulative hash value.

func (*Sequence) String

func (v *Sequence) String() string

String returns the string representation of the current hash value.

type Value

type Value uint32

Value is a hash value.

func BigInt

func BigInt(c *big.Int) Value

BigInt returns the hash of the given *big.Int.

func BigIntSlice

func BigIntSlice(S []*big.Int) Value

BigIntSlice returns the hash of the given slice.

func BigRat

func BigRat(c *big.Rat) Value

BigRat returns the hash of the given *big.Rat.

func BigRatSlice

func BigRatSlice(S []*big.Rat) Value

BigRatSlice returns the hash of the given slice.

func Bool

func Bool(b bool) Value

Bool returns the hash of the given boolean.

func BoolSlice

func BoolSlice(S []bool) Value

BoolSlice returns the hash of the given slice.

func Byte

func Byte(b byte) Value

Byte returns the hash of the given byte.

func ByteSlice

func ByteSlice(S []byte) Value

ByteSlice returns the hash of the given slice.

func Float32

func Float32(f float32) Value

Float32 returns the hash of the given float.

func Float32Slice

func Float32Slice(S []float32) Value

Float32Slice returns the hash of the given slice.

func Float64

func Float64(f float64) Value

Float64 returns the hash of the given float.

func Float64Slice

func Float64Slice(S []float64) Value

Float64Slice returns the hash of the given slice.

func HashSlice

func HashSlice(S []Hasher) Value

HashSlice returns the hash value of by the given slice.

func Int

func Int(c int) Value

Int returns the hash of the given integer.

func Int16

func Int16(c int16) Value

Int16 returns the hash of the given integer.

func Int16Slice

func Int16Slice(S []int16) Value

Int16Slice returns the hash of the given slice.

func Int32

func Int32(c int32) Value

Int32 returns the hash of the given integer.

func Int32Slice

func Int32Slice(S []int32) Value

Int32Slice returns the hash of the given slice.

func Int64

func Int64(c int64) Value

Int64 returns the hash of the given integer.

func Int64Slice

func Int64Slice(S []int64) Value

Int64Slice returns the hash of the given slice.

func Int8

func Int8(c int8) Value

Int8 returns the hash of the given integer.

func Int8Slice

func Int8Slice(S []int8) Value

Int8Slice returns the hash of the given slice.

func IntSlice

func IntSlice(S []int) Value

IntSlice returns the hash of the given slice.

func Slice

func Slice(S []Value) Value

Slice returns the hash value of the given slice.

func String

func String(s string) Value

String returns the hash of the given string.

func StringSlice

func StringSlice(S []string) Value

StringSlice returns the hash of the given slice.

func Uint

func Uint(c uint) Value

Uint returns the hash of the given unsigned integer.

func Uint16

func Uint16(c uint16) Value

Uint16 returns the hash of the given unsigned integer.

func Uint16Slice

func Uint16Slice(S []uint16) Value

Uint16Slice returns the hash of the given slice.

func Uint32

func Uint32(c uint32) Value

Uint32 returns the hash of the given unsigned integer.

func Uint32Slice

func Uint32Slice(S []uint32) Value

Uint32Slice returns the hash of the given slice.

func Uint64

func Uint64(c uint64) Value

Uint64 returns the hash of the given unsigned integer.

func Uint64Slice

func Uint64Slice(S []uint64) Value

Uint64Slice returns the hash of the given slice.

func Uint8

func Uint8(c uint8) Value

Uint8 returns the hash of the given unsigned integer.

func Uint8Slice

func Uint8Slice(S []uint8) Value

Uint8Slice returns the hash of the given slice.

func UintSlice

func UintSlice(S []uint) Value

UintSlice returns the hash of the given slice.

func (Value) Hash

func (h Value) Hash() Value

Hash returns the hash value.

func (Value) String

func (h Value) String() string

String returns the string representation of the hash value.

Jump to

Keyboard shortcuts

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