cityhash

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: BSD-3-Clause Imports: 1 Imported by: 7

README

cityhash

GoDoc Go Report Card

A transliteration of the CityHash implementation from C++ to Go.

This is a straightforward implementation in Go of the CityHash non-cryptographic hashing algorithm, done by transliterating the C++ implementation. The 32-bit, 64-bit, and 128-bit functions are implemented. The CRC functions (e.g., CityHashCrc128) are not implemented. This implementation is up-to-date with version 1.1.1 of the C++ library.

The unit tests were constructed by extracting the test vectors from the C++ unit test file. The convert_tests script does this extraction.

The original CityHash code can be found at: http://github.com/google/cityhash.

Documentation

Overview

Package cityhash implements the CityHash family of non-cryptographic string hashing functions.

The implementation is a fairly straightforward transliteration of the C++ code from https://github.com/google/cityhash. Most of the comments from the original are preserved here, except where they are obviously not true in the transliterated code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash128

func Hash128(s []byte) (lo, hi uint64)

Hash128 returns a 128-bit hash value for s.

func Hash128To64

func Hash128To64(lo, hi uint64) uint64

Hash128To64 returns a 64-bit hash value for an input of 128 bits.

func Hash128WithSeed

func Hash128WithSeed(s []byte, seed0, seed1 uint64) (lo, hi uint64)

Hash128WithSeed returns a 128-bit hash value for s that includes the given 128-bit seed.

func Hash32

func Hash32(s []byte) uint32

Hash32 returns a 32-bit hash for s.

func Hash64

func Hash64(s []byte) uint64

Hash64 returns a 64-bit hash for a slice of bytes.

func Hash64WithSeed

func Hash64WithSeed(s []byte, seed uint64) uint64

Hash64WithSeed returns a 64-bit hash for s that includes seed.

func Hash64WithSeeds

func Hash64WithSeeds(s []byte, seed0, seed1 uint64) uint64

Hash64WithSeeds returns a 64-bit hash for s that includes the two seed values.

Types

This section is empty.

Jump to

Keyboard shortcuts

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