blake2b

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package blake2b implements the BLAKE2b cryptographic hash function, with optimized variants for hashing Merkle tree inputs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New256

func New256() hash.Hash

New256 returns a new hash.Hash computing the BLAKE2b-256 checksum.

func Sum256

func Sum256(data []byte) [32]byte

Sum256 returns the BLAKE2b-256 checksum of the data.

func SumLeaf

func SumLeaf(leaf *[64]byte) [32]byte

SumLeaf computes the Merkle tree leaf hash of a single leaf.

func SumLeaves

func SumLeaves(outs *[4][32]byte, leaves *[4][64]byte)

SumLeaves computes the Merkle tree leaf hash of four leaves, storing the results in outs.

func SumNodes

func SumNodes(outs *[4][32]byte, nodes *[8][32]byte)

SumNodes computes the Merkle roots of four pairs of node hashes, storing the results in outs.

func SumPair

func SumPair(left, right [32]byte) [32]byte

SumPair computes the Merkle root of a pair of node hashes.

Types

type Accumulator added in v0.1.12

type Accumulator struct {
	Trees     [64][32]byte
	NumLeaves uint64
}

An Accumulator is a generic Merkle tree accumulator.

func (*Accumulator) AddLeaf added in v0.1.12

func (acc *Accumulator) AddLeaf(h [32]byte)

AddLeaf incorporates a leaf into the accumulator.

func (*Accumulator) Root added in v0.1.12

func (acc *Accumulator) Root() [32]byte

Root returns the Merkle root of the accumulator's leaves.

Jump to

Keyboard shortcuts

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