hash

package
v12.120.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 4 Imported by: 7

Documentation

Overview

Package hash contains different hash algorithms and utilities

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileHash

func FileHash(file string) string

FileHash generates an SHA-256 hash for a given file

Example
hash := FileHash("/path/to/some/file")

fmt.Println(hash)
Output:

func JCHash

func JCHash(key uint64, buckets int) int

JCHash generates Google's Jump Consistent Hash More info: http://arxiv.org/abs/1406.2294

Example
var (
	key     uint64 = 0xDEADBEEF
	buckets int    = 128 * 1024
)

hash := JCHash(key, buckets)

fmt.Println(hash)
Output:

110191

Types

This section is empty.

Jump to

Keyboard shortcuts

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