hash

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: BSD-3-Clause Imports: 6 Imported by: 2

Documentation

Overview

Package hash implments the Noise Protocol Framework hash function abstract interface and standard hash functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(hash Hash)

Register registers a new hash algorithm for use with `FromString()`.

Types

type Hash

type Hash interface {
	fmt.Stringer

	// New constructs a new `hash.Hash` instance.
	New() hash.Hash

	// Size returns the hash function's digest size in bytes (`HASHLEN`).
	Size() int
}

Hash is a collision-resistant cryptographic hash function factory.

var (
	// SHA256 is the SHA256 hash function.
	SHA256 Hash = &hashSha256{}

	// SHA512 is the SHA512 hash function.
	SHA512 Hash = &hashSha512{}

	// BLAKE2s is the BLAKE2s hash function.
	BLAKE2s Hash = &hashBlake2s{}

	// BLAKE2b is the BLAKE2b hash function.
	BLAKE2b Hash = &hashBlake2b{}
)

func FromString

func FromString(s string) Hash

FromString returns a Hash by algorithm name, or nil.

Jump to

Keyboard shortcuts

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