hash

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: MIT Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const LabelHashNestingDepth = 100

LabelHashNestingDepth is the number of recursive hashes per label.

Variables

This section is empty.

Functions

func GenLabelHashFunc

func GenLabelHashFunc(challenge []byte) func(data []byte) []byte

GenLabelHashFunc generates hash functions for computing labels. The challenge is prepended to the data and the result is hashed using Sha256. TODO: use nested hashes based on a difficulty param.

func GenMerkleHashFunc

func GenMerkleHashFunc(challenge []byte) func(lChild, rChild []byte) []byte

GenMerkleHashFunc generates Merkle hash functions salted with a challenge. The challenge is prepended to the concatenation of the left- and right-child in the tree and the result is hashed using Sha256.

⚠️ The resulting function is NOT thread-safe, however different generated instances are independent. The code is optimized for performance and memory allocations.

Types

This section is empty.

Jump to

Keyboard shortcuts

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