Documentation
¶
Index ¶
- Variables
- func CalculateLimit(maxCapacity, numItems, size uint64) uint64
- func DecodeDynamicLength(buf []byte, maxSize int) (int, error)
- func DivideInt(a, b int) (int, bool)
- func DivideInt2(a, b, max int) (int, error)
- func ExtendUint16(b []uint16, needLen int) []uint16
- func ExtendUint64(b []uint64, needLen int) []uint64
- func HashWithDefaultHasher(v HashRoot) ([32]byte, error)
- func MarshalBool(dst []byte, b bool) []byte
- func MarshalSSZ(m Marshaler) ([]byte, error)
- func MarshalUint16(dst []byte, i uint16) []byte
- func MarshalUint32(dst []byte, i uint32) []byte
- func MarshalUint64(dst []byte, i uint64) []byte
- func MarshalUint8(dst []byte, i uint8) []byte
- func ReadOffset(buf []byte) uint64
- func UnmarshalBool(src []byte) bool
- func UnmarshalDynamic(src []byte, length int, f func(indx int, b []byte) error) error
- func UnmarshalSSZTest(content []byte, result interface{}) error
- func UnmarshallUint16(src []byte) uint16
- func UnmarshallUint32(src []byte) uint32
- func UnmarshallUint64(src []byte) uint64
- func UnmarshallUint8(src []byte) uint8
- func ValidateBitlist(buf []byte, bitLimit uint64) error
- func WriteOffset(dst []byte, i int) []byte
- type HashRoot
- type Hasher
- func (h *Hasher) Append(i []byte)
- func (h *Hasher) AppendUint64(i uint64)
- func (h *Hasher) FillUpTo32()
- func (h *Hasher) HashRoot() (res [32]byte, err error)
- func (h *Hasher) Index() int
- func (h *Hasher) Merkleize(indx int)
- func (h *Hasher) MerkleizeWithMixin(indx int, num, limit uint64)
- func (h *Hasher) PutBitlist(bb []byte, maxSize uint64)
- func (h *Hasher) PutBool(b bool)
- func (h *Hasher) PutBytes(b []byte)
- func (h *Hasher) PutRootVector(b [][]byte, maxCapacity ...uint64) error
- func (h *Hasher) PutUint64(i uint64)
- func (h *Hasher) PutUint64Array(b []uint64, maxCapacity ...uint64)
- func (h *Hasher) Reset()
- type HasherPool
- type Marshaler
- type Unmarshaler
Constants ¶
This section is empty.
Variables ¶
var ( ErrOffset = fmt.Errorf("incorrect offset") ErrSize = fmt.Errorf("incorrect size") ErrBytesLength = fmt.Errorf("bytes array does not have the correct length") ErrVectorLength = fmt.Errorf("vector does not have the correct length") ErrListTooBig = fmt.Errorf("list length is higher than max value") ErrEmptyBitlist = fmt.Errorf("bitlist is empty") )
var ( // ErrIncorrectByteSize means that the byte size is incorrect ErrIncorrectByteSize = fmt.Errorf("incorrect byte size") // ErrIncorrectListSize means that the size of the list is incorrect ErrIncorrectListSize = fmt.Errorf("incorrect list size") )
Functions ¶
func CalculateLimit ¶
func DecodeDynamicLength ¶
DecodeDynamicLength decodes the length from the dynamic input
func DivideInt2 ¶
func ExtendUint16 ¶
ExtendUint16 extends a uint16 buffer to a given size
func ExtendUint64 ¶
ExtendUint64 extends a uint64 buffer to a given size
func HashWithDefaultHasher ¶
HashWithDefaultHasher hashes a HashRoot object with a Hasher from the default HasherPool
func MarshalBool ¶
MarshalBool marshals a boolean to dst
func MarshalUint16 ¶
MarshalUint16 marshals a little endian uint16 to dst
func MarshalUint32 ¶
MarshalUint32 marshals a little endian uint32 to dst
func MarshalUint64 ¶
MarshalUint64 marshals a little endian uint64 to dst
func MarshalUint8 ¶
MarshalUint8 marshals a little endian uint8 to dst
func UnmarshalBool ¶
UnmarshalBool unmarshals a boolean from the src input
func UnmarshalDynamic ¶
UnmarshalDynamic unmarshals the dynamic items from the input
func UnmarshalSSZTest ¶
func UnmarshallUint16 ¶
UnmarshallUint16 unmarshals a little endian uint16 from the src input
func UnmarshallUint32 ¶
UnmarshallUint32 unmarshals a little endian uint32 from the src input
func UnmarshallUint64 ¶
UnmarshallUint64 unmarshals a little endian uint64 from the src input
func UnmarshallUint8 ¶
UnmarshallUint8 unmarshals a little endian uint8 from the src input
func ValidateBitlist ¶
ValidateBitlist validates that the bitlist is correct
Types ¶
type Hasher ¶
type Hasher struct {
// contains filtered or unexported fields
}
Hasher is a utility tool to hash SSZ structs
func NewHasherWithHash ¶
NewHasher creates a new Hasher object
func (*Hasher) AppendUint64 ¶
func (*Hasher) FillUpTo32 ¶
func (h *Hasher) FillUpTo32()
func (*Hasher) MerkleizeWithMixin ¶
MerkleizeWithMixin is used to merkleize the last group of the hasher
func (*Hasher) PutBitlist ¶
PutBitlist appends a ssz bitlist
func (*Hasher) PutRootVector ¶
PutRootVector appends an array of roots
func (*Hasher) PutUint64Array ¶
PutUint64Array appends an array of uint64
type HasherPool ¶
type HasherPool struct {
// contains filtered or unexported fields
}
HasherPool may be used for pooling Hashers for similarly typed SSZs.
var DefaultHasherPool HasherPool
DefaultHasherPool is a default hasher pool
type Marshaler ¶
type Marshaler interface { MarshalSSZTo(dst []byte) ([]byte, error) MarshalSSZ() ([]byte, error) SizeSSZ() int }
Marshaler is the interface implemented by types that can marshal themselves into valid SZZ.
type Unmarshaler ¶
Unmarshaler is the interface implemented by types that can unmarshal a SSZ description of themselves