jenkins

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check()

func Hash232

func Hash232(k []byte, seed uint32) uint32

Jenkin's second generation 32 bit hash. Benchmarked with 4 byte key, inlining, and no store of hash at: benchmark32: 55 Mhashes/sec benchmark32: 219 MB/sec

func Hash264

func Hash264(k []byte, seed uint64) uint64

Jenkin's second generation 64 bit hash. Benchmarked with 24 byte key, inlining, store of hash in memory (cache miss every 4 hashes) and fast=true at: benchmark64: 26 Mhashes/sec benchmark64: 623 MB/sec

func HashBytesLength

func HashBytesLength(k []byte, length int, seed uint32) uint32

func HashString

func HashString(s string, pc, pb uint32) (rpc, rpb uint32)

func HashWords332

func HashWords332(k []uint32, seed uint32) uint32

func HashWordsLen

func HashWordsLen(k []uint32, length int, seed uint32) uint32

func Jenkins364

func Jenkins364(k []byte, length int, pc, pb uint32) (rpc, rpb uint32)

jenkins364: return 2 32-bit hash values. Returns two 32-bit hash values instead of just one. This is good enough for hash table lookup with 2^^64 buckets, or if you want a second hash if you're not happy with the first, or if you want a probably-unique 64-bit ID for the key. *pc is better mixed than *pb, so use *pc first. If you want a 64-bit value do something like "*pc + (((uint64_t)*pb)<<32)"

func New

func New(seed uint32) hash.Hash32

New returns a new hash.Hash32 interface that computes a 32 bit jenkins lookup3 hash.

func New232

func New232(seed uint32) nhash.HashF32

New returns a new nhash.HashF32 interface that computes a 32 bit jenkins lookup3 hash.

func New332c

func New332c(seed uint32) nhash.HashF32

New returns a new nhash.HashF32 interface that computes a 32 bit jenkins lookup3 hash.

func New364

func New364(seed uint64) nhash.Hash64

changed this from HashF64 to Hash64 to get streaming functions, what did I break? 7-22-15

func Sum32

func Sum32(data []byte, seed uint32) uint32

Sum32 returns the 32 bit hash of data given the seed. This is code is what I started with before I added the hash.Hash and hash.Hash32 interfaces.

func XHashWords

func XHashWords(k []uint32, length int, seed uint32) uint32

This is an example of how I could like to code hash functions like this. Using closures over the state and expecting thme to be inlined

Types

type State232

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

func (*State232) BlockSize

func (s *State232) BlockSize() int

Return the blocksize of the hash which in this case is 12 bytes at a time.

func (*State232) Hash32

func (s *State232) Hash32(b []byte, seeds ...uint32) uint32

func (*State232) HashSizeInBits

func (s *State232) HashSizeInBits() int

Return the number of bits the hash function outputs.

func (*State232) NumSeedBytes

func (s *State232) NumSeedBytes() int

Return the maximum number of seed bypes required.

func (*State232) Reset

func (s *State232) Reset()

Reset the hash state.

func (*State232) Size

func (s *State232) Size() int

Return the size of the resulting hash.

func (*State232) Sum

func (s *State232) Sum(b []byte) []byte

Return the current hash as a byte slice.

func (*State232) Sum32

func (s *State232) Sum32() uint32

Return the current hash as a 64 bit unsigned type.

func (*State232) Write

func (s *State232) Write(p []byte) (nn int, err error)

Accept a byte stream p used for calculating the hash. For now this call is lazy and the actual hash calculations take place in Sum() and Sum32().

type State264

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

type State332

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

type State332b

type State332b struct {
	State332
}

type State332c

type State332c struct {
	State332
}

func (*State332c) BlockSize

func (d *State332c) BlockSize() int

Return the blocksize of the hash which in this case is 1 byte.

func (*State332c) Hash32

func (d *State332c) Hash32(b []byte, seeds ...uint32) uint32

Given b as input and an optional 32 bit seed return the Jenkins lookup3 hash c bits.

func (*State332c) HashSizeInBits

func (d *State332c) HashSizeInBits() int

Return the number of bits the hash function outputs.

func (*State332c) NumSeedBytes

func (d *State332c) NumSeedBytes() int

Return the maximum number of seed bypes required. In this case 2 x 32

func (*State332c) Reset

func (d *State332c) Reset()

Reset the hash state.

func (*State332c) Size

func (d *State332c) Size() int

Return the size of the resulting hash.

func (*State332c) Sum

func (d *State332c) Sum(b []byte) []byte

Return the current hash as a byte slice.

func (*State332c) Sum32

func (d *State332c) Sum32() uint32

Return the current hash as a 32 bit unsigned type.

func (*State332c) Write

func (d *State332c) Write(p []byte) (nn int, err error)

Accept a byte stream p used for calculating the hash. For now this call is lazy and the actual hash calculations take place in Sum() and Sum32().

type State364

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

func (*State364) BlockSize

func (d *State364) BlockSize() int

Return the blocksize of the hash which in this case is 1 byte.

func (*State364) Hash64

func (d *State364) Hash64(b []byte, seeds ...uint64) uint64

func (*State364) Hash64S

func (d *State364) Hash64S(b []byte, seed uint64) uint64

func (*State364) HashSizeInBits

func (d *State364) HashSizeInBits() int

Return the number of bits the hash function outputs.

func (*State364) NumSeedBytes

func (d *State364) NumSeedBytes() int

Return the maximum number of seed bypes required. In this case 2 x 32

func (*State364) Reset

func (d *State364) Reset()

Reset the hash state.

func (*State364) Size

func (d *State364) Size() int

Return the size of the resulting hash.

func (*State364) Sum

func (d *State364) Sum(b []byte) []byte

Return the current hash as a byte slice.

func (*State364) Sum64

func (d *State364) Sum64() uint64

Return the current hash as a 64 bit unsigned type.

func (*State364) Write

func (d *State364) Write(p []byte) (nn int, err error)

Accept a byte stream p used for calculating the hash. For now this call is lazy and the actual hash calculations take place in Sum() and Sum32().

func (*State364) Write64

func (d *State364) Write64(h uint64) (err error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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