Documentation ¶
Index ¶
- func Base64Decode(b64 string) ([]byte, error)
- func Base64ToBytes(base64String string) ([]byte, error)
- func BytesToBase64(bytesArray []byte) string
- func BytesToUint16(b []byte) uint16
- func BytesToUint32(b []byte) uint32
- func EthBytesToUint32(b []byte) uint32
- func EthBytesToUint64(b []byte) uint64
- func HexDecode(h string) ([]byte, error)
- func HexDecodeInto(dst []byte, h []byte) error
- func HexEncode(bs []byte) string
- func SetBit(bitmap []byte, n uint)
- func SetBitBigEndian(bitmap []byte, n uint)
- func SwapEndianness(b []byte) []byte
- func TestBit(bitmap []byte, n uint) bool
- func TestBitBigEndian(bitmap []byte, n uint) bool
- func Uint16ToBytes(u uint16) []byte
- func Uint32ToBytes(u uint32) []byte
- func Uint32ToEthBytes(u uint32) []byte
- func Uint64ToEthBytes(u uint64) []byte
- func UnmarshalJSONHexDecode(bs []byte) ([]byte, error)
- func UnmarshalJSONHexDecodeInto(dst []byte, bs []byte) error
- type Hex
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Base64Decode ¶
Base64Decode decodes a string in base64 with optional padding into an array of bytes.
func Base64ToBytes ¶
Base64ToBytes converts a base64 encoded string into array of bytes
func BytesToBase64 ¶
BytesToBase64 converts an array of bytes to a base64 encoded string
func BytesToUint16 ¶
BytesToUint16 returns a uint16 from a byte array
func BytesToUint32 ¶
BytesToUint32 returns a uint32 from a byte array
func EthBytesToUint32 ¶
EthBytesToUint32 converts bytes as big endian to uint32.
func EthBytesToUint64 ¶
EthBytesToUint64 converts bytes as big endian to uint64.
func HexDecodeInto ¶
HexDecodeInto decodes a hex string into an array of bytes (dst), verifying that the decoded array has the same length as dst.
func SetBitBigEndian ¶
SetBitBigEndian sets the bit n in the bitmap to 1, in Big Endian.
func SwapEndianness ¶
SwapEndianness swaps the order of the bytes in the slice.
func TestBitBigEndian ¶
TestBitBigEndian tests whether the bit n in bitmap is 1, in Big Endian.
func Uint16ToBytes ¶
Uint16ToBytes returns a byte array from a uint16
func Uint32ToBytes ¶
Uint32ToBytes returns a byte array from a uint32
func Uint32ToEthBytes ¶
Uint32ToEthBytes converts a uint32 to bytes in big endian.
func Uint64ToEthBytes ¶
Uint64ToEthBytes convets a uint64 to bytes in big endian.
func UnmarshalJSONHexDecode ¶
UnmarshalJSONHexDecode decodes the JSON Hex string and returns the []byte
func UnmarshalJSONHexDecodeInto ¶
UnmarshalJSONHexDecodeInto decodes the JSON Hex string into bs
Types ¶
type Hex ¶
type Hex []byte
Hex is a byte slice type that can be marshalled and unmarshaled in hex
func (Hex) MarshalText ¶
MarshalText encodes buf as hex
func (*Hex) UnmarshalText ¶
UnmarshalText decodes a hex into buf