byteutils

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: LGPL-3.0 Imports: 5 Imported by: 15

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(data []byte, dec Decoder) (interface{}, error)

Decode decodes []byte from Decoder.

func Encode

func Encode(s interface{}, enc Encoder) ([]byte, error)

Encode encodes object to Encoder.

func Equal

func Equal(a []byte, b []byte) bool

Equal checks whether byte slice a and b are equal.

func FromHex

func FromHex(data string) ([]byte, error)

FromHex decodes string from Hex.

func FromInt16

func FromInt16(v int16) []byte

FromInt16 decodes int16 v.

func FromInt32

func FromInt32(v int32) []byte

FromInt32 decodes int32 v.

func FromInt64

func FromInt64(v int64) []byte

FromInt64 decodes int64 v.

func FromUint16

func FromUint16(v uint16) []byte

FromUint16 decodes uint16.

func FromUint32

func FromUint32(v uint32) []byte

FromUint32 decodes uint32.

func FromUint64

func FromUint64(v uint64) []byte

FromUint64 decodes unit64 value.

func HashBytes added in v1.0.0

func HashBytes(a []byte) uint32

HashBytes return bytes hash

func Hex

func Hex(data []byte) string

Hex encodes []byte to Hex.

func Int16

func Int16(data []byte) int16

Int16 encode []byte.

func Int32

func Int32(data []byte) int32

Int32 encodes []byte.

func Int64

func Int64(data []byte) int64

Int64 encodes []byte.

func Less added in v1.0.0

func Less(a []byte, b []byte) bool

Less return if a < b

func Uint16

func Uint16(data []byte) uint16

Uint16 encodes []byte.

func Uint32

func Uint32(data []byte) uint32

Uint32 encodes []byte.

func Uint64

func Uint64(data []byte) uint64

Uint64 encodes []byte.

Types

type Decoder

type Decoder interface {
	DecodeFromBytes(data []byte) (interface{}, error)
}

Decoder is decoder for bytes.Decode().

type Encoder

type Encoder interface {
	EncodeToBytes(s interface{}) ([]byte, error)
}

Encoder is encoder for bytes.Encode().

type Hash added in v1.0.0

type Hash []byte

Hash by Sha3-256

func (Hash) Base58 added in v1.0.0

func (h Hash) Base58() string

Base58 return base58 encodes string

func (Hash) Equals added in v1.0.0

func (h Hash) Equals(b Hash) bool

Equals compare two Hash. True is equal, otherwise false.

func (Hash) Hex added in v1.0.0

func (h Hash) Hex() HexHash

Hex return hex encoded hash.

func (Hash) String added in v1.0.0

func (h Hash) String() string

type HexHash added in v1.0.0

type HexHash string

HexHash is the hex string of a hash

func (HexHash) Hash added in v1.0.0

func (hh HexHash) Hash() (Hash, error)

Hash return hex decoded hash.

Jump to

Keyboard shortcuts

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