Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #117: Add support for encoding/decoding bech32 addresses using …
…iterators 5478e2b Add support for encoding/decoding bech32 addresses (Tobin C. Harding) Pull request description: (Friendly note: clarkmoody unless you are just loving all this iterator stuff I suggest you don't bother reviewing this one (or #113) until apoelstra acks :) This is a slightly different approach to #113. Done on top of #116, so just the last patch. - Conversion to/from bytes/fes by way of the extension traits as in #113 (still in `iter.rs`) - Checksum iter adapter as in #113 - Decoding by way of three structs depending on usage. - Encoding by way of a new struct `Encoder`, uses a builder-like pattern to construct the encoder and then one can call `chars()` to get a character iterator or `fes()` to get a field-element iterator (over all the fes that go into the checksum). This should mean: - Cleaner API i.e., easier to use but also easier to not use incorrectly - Incorrect use of iterator adaptors should now be harder IMNSHO the bech32 spec is convoluted as f**k, hiding all the details is not totally possible but this new API attempts to make it possible to correctly use the API without having to spend two weeks reading and re-reading bips 173 and 350. ### PR currently does not use the new API For example usage see: - the unit tests in `decode` and `encode` - the module level rustdocs in `encode.rs` and `decode.rs` - BIP-173 and BIP-350 test vectors in `tests/` ACKs for top commit: apoelstra: ACK 5478e2b Tree-SHA512: cd67c7624ef6829f470dab32cd98e5af019e190733515dd63702e3820063267fea4dbb086983d8b574381006e81df8ce4b41091fecbb1494e64592dc017fbeba
- Loading branch information