Documentation ¶
Index ¶
- Constants
- Variables
- func BuildParentTreeRoots(inputList [][32]byte) ([][32]byte, error)
- func BuildParentTreeRootsWithNRoutines(inputList [][32]byte, n int) ([][32]byte, error)
- func ByteSliceSSZ(input []byte) ([32]byte, error)
- func ListSSZ[T Hashable](elements []T, limit uint64) ([32]byte, error)
- func Vector(elements [][32]byte, length uint64) [32]byte
- func VectorSSZ[T Hashable](elements []T, length uint64) ([32]byte, error)
- type Hashable
Constants ¶
View Source
const ( // MinParallelizationSize is the minimum size of the input list that // should be hashed using the default method. If the input list is smaller // than this size, the overhead of parallelizing the hashing process is. // // TODO: This value is arbitrary and should be benchmarked to find the // optimal value. MinParallelizationSize = 5000 )
Variables ¶
View Source
var ( // ErrOddLengthTreeRoots is returned when the input list length must be // even. ErrOddLengthTreeRoots = errors.New("input list length must be even") // ErrMaxRootsExceeded is returned when the number of roots exceeds the // maximum allowed. ErrMaxRootsExceeded = errors.New( "number of roots exceeds the maximum allowed", ) )
Functions ¶
func BuildParentTreeRoots ¶
BuildParentTreeRoots calls BuildParentTreeRootsWithNRoutines with the number of routines set to runtime.GOMAXPROCS(0)-1.
func BuildParentTreeRootsWithNRoutines ¶
BuildParentTreeRootsWithNRoutines optimizes hashing of a list of roots using CPU-specific vector instructions and parallel processing. This method adapts to the host machine's hardware for potential performance gains over sequential hashing.
func ByteSliceSSZ ¶
ByteSliceSSZ hashes a byteslice by chunkifying it and returning the corresponding HTR as if it were a fixed vector of bytes of the given length.
func ListSSZ ¶
ListSSZ hashes each element in the list and then returns the HTR of the list of corresponding roots, with the length mixed in.
Types ¶
Click to show internal directories.
Click to hide internal directories.