seahash

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: May 27, 2018 License: MIT Imports: 2 Imported by: 0

README

seahash

Build Status Coverage Status GoDoc

A Go port of the SeaHash algorithm.

Benchmarks

Intel(R) Xeon(R) CPU E3-1505M v6 @ 3.00GHz

$ go test -bench .
BenchmarkSum-8     	30000000	        47.2 ns/op
BenchmarkSum64-8   	50000000	        33.0 ns/op

Documentation

Overview

Package seahash implements SeaHash, a non-cryptographic hash function created by http://ticki.github.io.

See https://ticki.github.io/blog/seahash-explained.

Index

Examples

Constants

View Source
const BlockSize = 8

BlockSize of SeaHash in bytes.

View Source
const Size = 8

Size of a SeaHash checksum in bytes.

Variables

This section is empty.

Functions

func New

func New() hash.Hash64

New creates a new SeaHash hash.Hash64

Example
// hash some bytes
h := New()
h.Write([]byte("to be or not to be"))
hash := h.Sum64()
fmt.Printf("%x", hash)
Output:

1b993a826f4ae575

func Sum

func Sum(b []byte) []byte

Sum is a convenience method that returns the checksum of the byte slice

Example
// hash some bytes
hash := Sum([]byte("to be or not to be"))
fmt.Printf("%x", hash)
Output:

75e54a6f823a991b

func Sum64 added in v1.1.0

func Sum64(b []byte) uint64

Sum64 is a convenience method that returns uint64 checksum of the byte slice

Example
// hash some bytes
fmt.Printf("%x", Sum64([]byte("to be or not to be")))
Output:

1b993a826f4ae575

Types

This section is empty.

Jump to

Keyboard shortcuts

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