blake3

package
v1.17.28 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package blake3 provides Blake3 hash functions for cryptographic operations. This is extracted from the threshold package to provide a centralized implementation for all Lux projects.

Index

Constants

View Source
const DigestLength = 64 // 512 bits

DigestLength is the standard output length for Blake3 hashes

Variables

This section is empty.

Functions

This section is empty.

Types

type Digest

type Digest [DigestLength]byte

Digest represents a Blake3 hash output

func HashBytes

func HashBytes(data []byte) Digest

HashBytes hashes a byte slice and returns a digest

func HashString

func HashString(s string) Digest

HashString hashes a string and returns a digest

func HashWithDomain

func HashWithDomain(domain string, data []byte) Digest

HashWithDomain hashes data with a domain separator

type Hasher

type Hasher struct {
	// contains filtered or unexported fields
}

Hasher wraps blake3.Hasher to provide a consistent interface

func New

func New() *Hasher

New creates a new Blake3 hasher

func NewWithDomain

func NewWithDomain(domain string) *Hasher

NewWithDomain creates a new Blake3 hasher with a domain separator

func (*Hasher) Clone

func (h *Hasher) Clone() *Hasher

Clone creates a copy of the hasher

func (*Hasher) Digest

func (h *Hasher) Digest() Digest

Digest returns a fixed-size digest

func (*Hasher) Reader

func (h *Hasher) Reader() io.Reader

Reader returns an io.Reader for extended output

func (*Hasher) Reset

func (h *Hasher) Reset()

Reset resets the hasher to its initial state

func (*Hasher) Sum

func (h *Hasher) Sum(b []byte) []byte

Sum returns the hash digest

func (*Hasher) Write

func (h *Hasher) Write(p []byte) (n int, err error)

Write adds data to the hash

func (*Hasher) WriteBigInt

func (h *Hasher) WriteBigInt(n *big.Int)

WriteBigInt adds a big.Int to the hash

func (*Hasher) WriteString

func (h *Hasher) WriteString(s string) (n int, err error)

WriteString adds a string to the hash

func (*Hasher) WriteUint32

func (h *Hasher) WriteUint32(v uint32)

WriteUint32 adds a uint32 to the hash in big-endian format

func (*Hasher) WriteUint64

func (h *Hasher) WriteUint64(v uint64)

WriteUint64 adds a uint64 to the hash in big-endian format

Jump to

Keyboard shortcuts

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