hasher

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2026 License: BSD-2-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package hasher provides types and interfaces for hash calculating.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher interface {
	Name() string
	Hash(data []byte) ([]byte, error)
}

Hasher is the interface that storage hashers must implement. It provides low-level operations for hash calculating.

Implementations must accept nil and zero-length input and return the well-defined hash of the empty bit string for both. This matters because storage backends round-trip empty values as nil, so a read of a legitimately-empty value must hash without error.

func NewHexHasher added in v1.6.1

func NewHexHasher(h Hasher) Hasher

NewHexHasher wraps h so that Hash returns a lower-case hex-encoded digest.

func NewHexSHA1Hasher added in v1.6.1

func NewHexSHA1Hasher() Hasher

NewHexSHA1Hasher creates a SHA-1 hasher whose Hash output is hex-encoded.

func NewHexSHA256Hasher added in v1.6.1

func NewHexSHA256Hasher() Hasher

NewHexSHA256Hasher creates a SHA-256 hasher whose Hash output is hex-encoded.

func NewSHA1Hasher

func NewSHA1Hasher() Hasher

NewSHA1Hasher creates a new NewSHA1Hasher instance.

func NewSHA256Hasher

func NewSHA256Hasher() Hasher

NewSHA256Hasher creates a new sha256Hasher instance.

Jump to

Keyboard shortcuts

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