Documentation
¶
Index ¶
- func AddZeroBytesSuffix(data []byte, required int) []byte
- func ClearBit(n byte, pos uint) byte
- func ContainsBytesInSlice(slice [][]byte, b []byte) bool
- func IntBytesFromString(s string) ([]byte, error)
- func IsBitSet(n byte, pos uint) bool
- func RemoveZeroBytesSuffix(data []byte) []byte
- func SetBit(n byte, pos uint) byte
- func SortByte32Slice(arr [][32]byte) [][32]byte
- type BytesArray
- type HexBytes
- type OptionalHex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddZeroBytesSuffix ¶
AddZeroBytesSuffix appends zero bytes such that result byte length == required
func ContainsBytesInSlice ¶
ContainsBytesInSlice returns bool if byte slice is contained in input
func IntBytesFromString ¶
IntBytesFromString return the integer base 10 string in bytes.
func RemoveZeroBytesSuffix ¶
RemoveZeroBytesSuffix removes zero bytes appended to the end.
func SortByte32Slice ¶ added in v1.0.0
SortByte32Slice sorts the byte32 slices in ascending order.
Types ¶
type BytesArray ¶ added in v1.0.0
type BytesArray [][32]byte
BytesArray is a alias for 32 byte alice
func (BytesArray) Len ¶ added in v1.0.0
func (a BytesArray) Len() int
Len returns the length of the slice
func (BytesArray) Less ¶ added in v1.0.0
func (a BytesArray) Less(i, j int) bool
Less returns true if i'th item is less than j'th else false
func (BytesArray) Swap ¶ added in v1.0.0
func (a BytesArray) Swap(i, j int)
Swap swaps the i, j values with in the array.
type HexBytes ¶ added in v1.0.0
type HexBytes []byte
HexBytes is of type bytes with JSON hex string marshaller.
func (HexBytes) MarshalJSON ¶ added in v1.0.0
MarshalJSON marshall bytes to hex.
func (*HexBytes) UnmarshalJSON ¶ added in v1.0.0
UnmarshalJSON unmarshals hex string to bytes.
type OptionalHex ¶ added in v1.0.0
type OptionalHex struct {
HexBytes
}
OptionalHex can have empty hex string and doesn't error.
func (*OptionalHex) UnmarshalJSON ¶ added in v1.0.0
func (o *OptionalHex) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshalls hex encoded string to bytes. if the data is an empty string, it decoded value is empty bytes.