common

package
v0.0.0-...-80347e8 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddrDefaultVersion = 0
)
View Source
const Coin = 10 ^ 6

Variables

View Source
var (
	ZeroHash        = Bytes2Hash([]byte{})
	AddrCheckSumLen = 4
)
View Source
var Big0 = new(big.Int).SetInt64(0)
View Source
var Zero = int(0)

Functions

func B58Decode

func B58Decode(enc []byte) []byte

func B58Encode

func B58Encode(data []byte) []byte

func BytesEquals

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

func BytesMixed

func BytesMixed(src []byte, lenBits int, buffer *bytes.Buffer) error

func Decode16Byte

func Decode16Byte(str string) []byte

func Encode16Byte

func Encode16Byte(byteVal []byte) string

func Hex2bytes

func Hex2bytes(s string) []byte

func IsZero

func IsZero(a []byte) bool

func IsZeroHash

func IsZeroHash(h Hash) bool

func ObjSHA256

func ObjSHA256(obj rawencode.RawEncoder) ([]byte, []byte, error)

func ParseString2BigInt

func ParseString2BigInt(str string) *big.Int

func PrefixDiff

func PrefixDiff(a, b []byte, n int) int

PrefixDiff counts the number of equal prefixed bits of a and b.

func PrefixLen

func PrefixLen(a []byte) int

PrefixLen returns the number of prefixed zero bits of a.

func ReadMixedBytes

func ReadMixedBytes(buf *bytes.Buffer) ([]byte, error)

func Uint64s

func Uint64s(t json.Number) (uint64, error)

func XOR

func XOR(a, b []byte) []byte

XOR allocates a new byte slice with the computed result of XOR(a, b).

Types

type Address

type Address [addrLen]byte

func B58ToAddress

func B58ToAddress(enc []byte) Address

func Bytes2Address

func Bytes2Address(b []byte) Address

func Hex2Address

func Hex2Address(s string) Address

func StrB58ToAddress

func StrB58ToAddress(enc string) Address

func (*Address) B58

func (a *Address) B58() []byte

func (*Address) B58String

func (a *Address) B58String() string

func (*Address) Bytes

func (a *Address) Bytes() []byte

func (*Address) Checksum

func (a *Address) Checksum() []byte

func (*Address) Equals

func (a *Address) Equals(b Address) bool

func (*Address) Hex

func (a *Address) Hex() string

func (*Address) MarshalJSON

func (a *Address) MarshalJSON() ([]byte, error)

func (*Address) Payload

func (a *Address) Payload() []byte

func (*Address) PubKeyHash

func (a *Address) PubKeyHash() []byte

func (*Address) SetBytes

func (a *Address) SetBytes(b []byte)

func (*Address) String

func (a *Address) String() string

func (*Address) UnmarshalJSON

func (a *Address) UnmarshalJSON(data []byte) error

func (*Address) Version

func (a *Address) Version() uint8

type Hash

type Hash [hashLen]byte

func Bytes2Hash

func Bytes2Hash(b []byte) Hash

func Hex2Hash

func Hex2Hash(s string) Hash

func (*Hash) Bytes

func (h *Hash) Bytes() []byte

func (*Hash) Hex

func (h *Hash) Hex() string

func (*Hash) MarshalJSON

func (h *Hash) MarshalJSON() ([]byte, error)

func (*Hash) SetBytes

func (h *Hash) SetBytes(other []byte)

func (*Hash) UnmarshalJSON

func (h *Hash) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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