byteutils

package
v0.0.0-...-5fbb372 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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

// Encode encodes object to Encoder.

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

// Decode decodes []byte from Decoder.

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

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 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