ajhash

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package ajhash provides helpers for working with the stdlib hashing algorithms.

Index

Constants

View Source
const (
	DefaultAlgo = AlgoSHA256 // The default hash algorithm is SHA-256
)

Variables

This section is empty.

Functions

func AllZeroBytes

func AllZeroBytes(buf []byte) bool

Return true if all the bytes in the slice are zero.

Types

type Algo

type Algo uint8

Algo specifies the type of hashing algorithm being used and provides helper functions.

const (
	AlgoSHA1   Algo = 1 + iota // SHA-1
	AlgoSHA256                 // SHA-256
	AlgoSHA512                 // SHA-512
)

func (Algo) Buffer

func (h Algo) Buffer() []byte

Return a slice of bytes that is of the correct digest size that can be used for reading or writing.

func (Algo) HashedStringForZeroBytes

func (h Algo) HashedStringForZeroBytes() string

Return the hash (as a string) for when zero bytes are hashed.

func (Algo) Hasher

func (h Algo) Hasher() hash.Hash

Return the hasher to be used for the algorithm.

func (Algo) Size

func (h Algo) Size() int

Return the size of bytes that a digest for the hashing algorithm uses.

func (Algo) String

func (h Algo) String() string

Stringer implementation.

func (Algo) ZeroValue

func (h Algo) ZeroValue() []byte

Return a slice of bytes that is of the correct digest size and contains only zeroes.

Jump to

Keyboard shortcuts

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