package
0.0.0-20191201205449-f379a713d0c2
Repository: https://github.com/rjected/lit.git
Documentation: pkg.go.dev

# README

bech32 in go

bech32 is an encoding scheme by Pieter Wuille and Greg Maxwell described in a yet-to-be numbered BIP (https://github.com/sipa/bech32/blob/master/bip-witaddr.mediawiki)

It's a nice improvement over the original base58check encoding used in Bitcoin.

This code is still in progress but should be compatible with the C and python implementations linked in the BIP.

# Functions

Bytes5to8 goes from squashed bytes to full height bytes.
Bytes8to5 extends a byte slice into a longer, padded byte slice of 5-bit elements where the high 3 bits are all 0.
ByteSquasher squashes full-width (8-bit) bytes into "squashed" 5-bit bytes, and vice versa.
create checksum makes a 6-shortbyte checksum from the HRP and data parts.
Decode takes a bech32 encoded string and returns the hrp and the full-height data.
DecodeSquashed is the same as Decode, but will return squashed 5-bit high data.
Encode takes regular bytes of data, and an hrp prefix, and returns the bech32 encoded string.
EncodeSquashed takes the hrp prefix, as well as byte data that has already been squashed to 5-bits high, and returns the bech32 encoded string.
Segwit addresses can't be used in Encode and Decode directly, because the witness version is special and doesn't get squashed.
HRPExpand turns the human redable part into 5bit-bytes for later processing.
PolyMod takes a byte slice and returns the 32-bit BCH checksum.
SegWitAddressDecode takes a segwit address and returns the pkscript that can go directly into the txout.
SegWitAddressEncode takes an hrp and data and gives back a segwit address.
SegWitV0Encode takes an hrp prefix string and a 20 or 32 byte witness program hash, and turns it into a version 0 address.
SquashedBytesToString swaps 5-bit bytes with a string of the corresponding letters.
StringToSquashedBytes uses the inverseCharset to switch from the characters back to 5-bit squashed bytes.
No description provided by the author