d63d9f2b44
Since bech32 itself works with data encoded with 5 bits per byte (aka base32) padded out to the nearest byte boundary, the existing functions for Encode and Decode accept and return data encoded that way. However, the most common way to use bech32 is to encode data that is already encoded with 8 bits per byte (aka base256) without padding which means it is up to the caller to use the ConvertBits function properly to convert between the two encodings. Consequently, this introduces two convenience functions for working directly with base256-encoded data named EncodeFromBase256 and DecodeToBase256 along with a full set of tests to ensure they work expected. |
||
---|---|---|
.. | ||
bech32.go | ||
bech32_test.go | ||
doc.go | ||
error.go | ||
example_test.go | ||
README.md |
bech32
Package bech32 provides a Go implementation of the bech32 format specified in BIP 173.
Test vectors from BIP 173 are added to ensure compatibility with the BIP.
Installation and Updating
$ go get -u github.com/btcsuite/btcutil/bech32
Examples
- Bech32 decode Example Demonstrates how to decode a bech32 encoded string.
- Bech32 encode Example Demonstrates how to encode data into a bech32 string.
License
Package bech32 is licensed under the copyfree ISC License.