byteutils

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2018 License: LGPL-3.0 Imports: 5 Imported by: 0

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

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

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

type Hash []byte

Hash by Sha3-256

func (Hash) Base58

func (h Hash) Base58() string

Base58 return base58 encodes string

func (Hash) Equals

func (h Hash) Equals(b Hash) bool

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

func (Hash) Hex

func (h Hash) Hex() HexHash

Hex return hex encoded hash.

func (Hash) String

func (h Hash) String() string

type HexHash

type HexHash string

HexHash is the hex string of a hash

func (HexHash) Hash

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