fnv

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package fnv implements FNV-1 and FNV-1a, non-cryptographic hash functions with non-allocating convenience methods for hashing of common types. Compatible with standard library hash/fnv.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func String64

func String64(str string) uint64

String64 returns a 64-bit hash of str using the FNV-1 algorithm.

func String64a

func String64a(str string) uint64

String64a returns a 64-bit hash of str using the FNV-1a algorithm.

func Sum64

func Sum64(buf []byte) uint64

Sum64 returns a 64-bit hash of buf using the FNV-1 algorithm.

func Sum64a

func Sum64a(buf []byte) uint64

Sum64a returns a 64-bit hash of buf using the FNV-1a algorithm.

Types

type Fnv64

type Fnv64 uint64

64-bit FNV-1 hash.

func New64

func New64() *Fnv64

New64 returns a new 64-bit FNV-1 hash.

func (*Fnv64) BlockSize

func (s *Fnv64) BlockSize() int

BlockSize returns the hash's underlying block size.

func (*Fnv64) Reset

func (s *Fnv64) Reset()

Reset resets the Hash to its initial state.

func (*Fnv64) Size

func (s *Fnv64) Size() int

Size returns the number of bytes Sum will return.

func (*Fnv64) Sum

func (s *Fnv64) Sum(buf []byte) []byte

Sum appends the current hash to buf in big-endian byte order and returns the resulting slice.

func (*Fnv64) Sum64

func (s *Fnv64) Sum64() uint64

Sum64 returns the current hash value.

func (*Fnv64) Write

func (s *Fnv64) Write(data []byte) (int, error)

Write adds the bytes in data to the running hash. It never returns an error.

func (*Fnv64) WriteByte

func (s *Fnv64) WriteByte(b byte) error

Write adds the single byte b to the running hash. It never returns an error.

func (*Fnv64) WriteString

func (s *Fnv64) WriteString(str string) (int, error)

WriteString adds the bytes of string str to the running hash and returns the number of bytes written. It never returns an error.

func (*Fnv64) WriteUint64

func (s *Fnv64) WriteUint64(n uint64)

WriteUint64 adds the 8 bytes of n to the running hash in big-endian byte order.

type Fnv64a

type Fnv64a uint64

64-bit FNV-1a hash.

func New64a

func New64a() *Fnv64a

New64a returns a new 64-bit FNV-1a hash.

func (*Fnv64a) BlockSize

func (s *Fnv64a) BlockSize() int

BlockSize returns the hash's underlying block size.

func (*Fnv64a) Reset

func (s *Fnv64a) Reset()

Reset resets the Hash to its initial state.

func (*Fnv64a) Size

func (s *Fnv64a) Size() int

Size returns the number of bytes Sum will return.

func (*Fnv64a) Sum

func (s *Fnv64a) Sum(buf []byte) []byte

Sum appends the current hash to buf in big-endian byte order and returns the resulting slice.

func (*Fnv64a) Sum64

func (s *Fnv64a) Sum64() uint64

Sum64 returns the current hash value.

func (*Fnv64a) Write

func (s *Fnv64a) Write(data []byte) (int, error)

Write adds the bytes in data to the running hash. It never returns an error.

func (*Fnv64a) WriteByte

func (s *Fnv64a) WriteByte(b byte) error

Write adds the single byte b to the running hash. It never returns an error.

func (*Fnv64a) WriteString

func (s *Fnv64a) WriteString(str string) (int, error)

WriteString adds the bytes of string str to the running hash and returns the number of bytes written. It never returns an error.

func (*Fnv64a) WriteUint64

func (s *Fnv64a) WriteUint64(n uint64)

WriteUint64 adds the 8 bytes of n to the running hash in big-endian byte order.

Source Files

Jump to

Keyboard shortcuts

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