utils

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const VERSIONED_HASH_VERSION_KZG byte = byte(1)

Variables

View Source
var IsSysLittleEndian bool

Functions

func BitsOnCount

func BitsOnCount(b []byte) int

func Bytes4ToUint32

func Bytes4ToUint32(bytes4 [4]byte) uint32

func BytesToBytes4

func BytesToBytes4(b []byte) (ret [4]byte)

func CompressSnappy

func CompressSnappy(data []byte) []byte

func DecodeSSZSnappy

func DecodeSSZSnappy(dst ssz.Unmarshaler, src []byte, version int) error

func DecompressSnappy

func DecompressSnappy(data []byte) ([]byte, error)

func EncodeSSZSnappy

func EncodeSSZSnappy(data ssz.Marshaler) ([]byte, error)

func ExtractSlotFromSerializedBeaconState

func ExtractSlotFromSerializedBeaconState(beaconState []byte) (uint64, error)

func FlipBitOn

func FlipBitOn(b []byte, i int)

func GetBitlistLength

func GetBitlistLength(b []byte) int

getBitlistLength return the amount of bits in given bitlist.

func IntegerSquareRoot

func IntegerSquareRoot(n uint64) uint64

func IntersectionOfSortedSets

func IntersectionOfSortedSets(v1, v2 []uint64) []uint64

func IsBitOn

func IsBitOn(b []byte, idx int) bool

func IsNonStrictSupersetBitlist

func IsNonStrictSupersetBitlist(a, b []byte) bool

IsNonStrictSupersetBitlist checks if bitlist 'a' is a non-strict superset of bitlist 'b'

func IsOverlappingBitlist

func IsOverlappingBitlist(a, b []byte) bool

func IsPowerOf2

func IsPowerOf2(n uint64) bool

func IsValidMerkleBranch

func IsValidMerkleBranch(leaf libcommon.Hash, branch []libcommon.Hash, depth uint64, index uint64, root [32]byte) bool

Check if leaf at index verifies against the Merkle root and branch

func KzgCommitmentToVersionedHash

func KzgCommitmentToVersionedHash(kzgCommitment libcommon.Bytes48) (libcommon.Hash, error)

func MergeBitlists

func MergeBitlists(a, b []byte)

func PowerOf2

func PowerOf2(n uint64) uint64

func PreparateRootsForHashing

func PreparateRootsForHashing(roots []libcommon.Hash) [][32]byte

func ReverseOfByteSlice

func ReverseOfByteSlice(b []byte) (out []byte)

func Sha256

func Sha256(data []byte, extras ...[]byte) [32]byte

General purpose Sha256

func Uint32ToBytes4

func Uint32ToBytes4(n uint32) (ret [4]byte)

func Uint64ToLE

func Uint64ToLE(i uint64) []byte

Types

type HashFunc

type HashFunc func(data []byte, extras ...[]byte) [32]byte

func OptimizedSha256NotThreadSafe

func OptimizedSha256NotThreadSafe() HashFunc

Optimized Sha256, avoid pool.put/pool.get, meant for intensive operations. this version is not thread safe

Directories

Path Synopsis
Package eth_clock is a generated GoMock package.
Package eth_clock is a generated GoMock package.

Jump to

Keyboard shortcuts

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