blech32

package
v0.4.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertBits

func ConvertBits(data []byte, fromBits, toBits uint8, pad bool) ([]byte, error)

ConvertBits converts a byte slice where each byte is encoding fromBits bits, to a byte slice where each byte is encoding toBits bits.

func Decode

func Decode(addr string) (string, []byte, error)

Decode is like DecodeGeneric but also checks the checksum according to segwit version.

func DecodeGeneric added in v0.4.0

func DecodeGeneric(blech string) (string, []byte, []byte, error)

Decode decodes a blech32 encoded string, returning the human-readable part and the data part excluding the checksum.

func Encode

func Encode(hrp string, data []byte, encoding EncodingType) (string, error)

Encode encodes a byte slice into a blech32 string with the human-readable part hrb. Note that the bytes must each encode 5 bits (base32).

Types

type EncodingType added in v0.4.0

type EncodingType int64
const (
	BLECH32  EncodingType = 0x01
	BLECH32M EncodingType = 0x455972a3350f7a1
)

func EncodingTypeFromSegwitVersion added in v0.4.0

func EncodingTypeFromSegwitVersion(version byte) (EncodingType, error)

Jump to

Keyboard shortcuts

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