eth2shuffle

package
v0.0.0-...-1f8a15b Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PermuteIndex

func PermuteIndex(hashFn HashFn, rounds uint8, index uint64, listSize uint64, seed [32]byte) uint64

Permute index, i.e. shuffle an individual list item without allocating a complete list. Returns the index in the would-be shuffled list.

func ShuffleList

func ShuffleList[T any](hashFn HashFn, input []T, rounds uint8, seed [32]byte)

Shuffles the list

func UnpermuteIndex

func UnpermuteIndex(hashFn HashFn, rounds uint8, index uint64, listSize uint64, seed [32]byte) uint64

Inverse of PermuteIndex, returns original index when given the same shuffling context parameters and permuted index.

func UnshuffleList

func UnshuffleList[T any](hashFn HashFn, input []T, rounds uint8, seed [32]byte)

Un-shuffles the list

Types

type HashFn

type HashFn func(input []byte) []byte

Jump to

Keyboard shortcuts

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