common

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode added in v0.0.3

func Base64Decode(b64 string) ([]byte, error)

Base64Decode decodes a string in base64 with optional padding into an array of bytes.

func Base64ToBytes

func Base64ToBytes(base64String string) ([]byte, error)

Base64ToBytes converts a base64 encoded string into array of bytes

func BytesToBase64

func BytesToBase64(bytesArray []byte) string

BytesToBase64 converts an array of bytes to a base64 encoded string

func BytesToUint32

func BytesToUint32(b []byte) uint32

BytesToUint32 returns a uint32 from a byte array

func HexDecode

func HexDecode(h string) ([]byte, error)

HexDecode decodes a hex string into an array of bytes.

func HexDecodeInto

func HexDecodeInto(dst []byte, h []byte) error

HexDecodeInto decodes a hex string into an array of bytes (dst), verifying that the decoded array has the same length as dst.

func HexEncode

func HexEncode(bs []byte) string

HexEncode encodes an array of bytes into a string in hex.

func Uint32ToBytes

func Uint32ToBytes(u uint32) []byte

Uint32ToBytes returns a byte array from a uint32

func UnmarshalJSONHexDecode added in v0.0.3

func UnmarshalJSONHexDecode(bs []byte) ([]byte, error)

UnmarshalJSONHexDecode decodes the JSON Hex string and returns the []byte

func UnmarshalJSONHexDecodeInto

func UnmarshalJSONHexDecodeInto(dst []byte, bs []byte) error

UnmarshalJSONHexDecodeInto decodes the JSON Hex string into bs

Types

type Hex added in v0.0.5

type Hex []byte

Hex is a byte slice type that can be marshalled and unmarshaled in hex

func (Hex) MarshalText added in v0.0.5

func (buf Hex) MarshalText() ([]byte, error)

MarshalText encodes buf as hex

func (Hex) String added in v0.0.5

func (buf Hex) String() string

String encodes buf as hex

func (*Hex) UnmarshalText added in v0.0.5

func (buf *Hex) UnmarshalText(h []byte) error

UnmarshalText decodes a hex into buf

Jump to

Keyboard shortcuts

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