encoding

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TypeHex encoding value.
	TypeHex = "hex/plain"
	// TypeHex0XPrefix encoding value.
	TypeHex0XPrefix = "hex/0x-prefix"
	// TypeBase58 encoding value.
	TypeBase58 = "base58/plain"
	// TypeBase58SubstrateAddress encoding value.
	TypeBase58SubstrateAddress = "base58/ss58-address"
)

Variables

This section is empty.

Functions

func DataPrefix

func DataPrefix() []byte

DataPrefix used to identify Mailchain messages.

func DecodeBase58 added in v0.0.38

func DecodeBase58(src string) ([]byte, error)

DecodeBase58 returns the bytes represented by the base58 string src.

DecodeBase58 expects that src contains only base58 characters. If the input is malformed, DecodeBase58 returns an error.

func DecodeHex added in v0.0.38

func DecodeHex(s string) ([]byte, error)

DecodeHex returns the bytes represented by the hexadecimal string s.

DecodeHex expects that src contains only hexadecimal characters and that src has even length. If the input is malformed, DecodeString returns the bytes decoded before the error.

func DecodeHexZeroX added in v0.0.38

func DecodeHexZeroX(in string) ([]byte, error)

DecodeHexZeroX returns the bytes represented by the hexadecimal string src.

DecodeHexZeroX expects that src contains only hex characters and must contain a `0x` prefix. If the input is malformed, DecodeHexZeroX returns an error.

func EncodeBase58 added in v0.0.38

func EncodeBase58(src []byte) (string, error)

EncodeBase58 returns the string represented by the base58 byte src.

EncodeBase58 expects that src contains only base58 byte. If the input is malformed, EncodeBase58 returns an error.

func EncodeHex added in v0.0.38

func EncodeHex(src []byte) string

EncodeHex returns the hexadecimal encoding of src.

func EncodeHexZeroX added in v0.0.38

func EncodeHexZeroX(src []byte) (encoded string)

EncodeHexZeroX encodes src into "0x"+hex.Encode. As a convenience, it returns the encoding type used, but this value is always TypeHex0XPrefix. EncodeHexZeroX uses hexadecimal encoding prefixed with "0x".

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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