hashext

package
v0.0.0-...-e0b30e9 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package hashext provides extensions to the standard crypto/hash package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiHash

type MultiHash []TypedHash

MultiHash is an interface providing hash.Hash over multiple hash instances.

func NewMultiHash

func NewMultiHash(hs ...crypto.Hash) MultiHash

NewMultiHash creates a new MultiHash.

func (MultiHash) BlockSize

func (m MultiHash) BlockSize() int

BlockSize returns a representative block size or the smallest from contained hashes.

func (MultiHash) Reset

func (m MultiHash) Reset()

Reset calls Hash.Reset on all contained hashes.

func (MultiHash) Size

func (m MultiHash) Size() int

Size returns the size of the Sum.

func (MultiHash) Sum

func (m MultiHash) Sum(b []byte) []byte

Sum constructs an aggregate by concatenating all hash Sum results with their algorithm types.

func (MultiHash) Write

func (m MultiHash) Write(p []byte) (int, error)

Sum writes all contained hashes.

type TypedHash

type TypedHash struct {
	hash.Hash
	Algorithm crypto.Hash
}

TypedHash is a hash.Hash annotated with its algorithm.

func NewTypedHash

func NewTypedHash(algo crypto.Hash) TypedHash

NewTypedHash constructs a new TypedHash.

Jump to

Keyboard shortcuts

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