bech32 icon indicating copy to clipboard operation
bech32 copied to clipboard

Java implementation

Open SamouraiDev opened this issue 7 years ago • 2 comments

Bech32 encoding of SegWit addresses in Java. Build instructions are in README.md.

SamouraiDev avatar Jun 19 '17 14:06 SamouraiDev

Thanks a lot for doing this, and my apologies for the slow responses.

Two comments:

  • I prefer to have "reference implementations" - things that are easily copy-pastable (and possibly modifiable) into your own project, rather than fully-fledged packages. That means preferably few dependencies or build systems - obviously depending on the programming culture in that language. Are the two apache things you depend on typical things to use?
  • Could the hrp argument to encode, and the left value of the pair returned by decode by a string rather than a byte vector? That would seem more intuitive and easier to use, as the hrp is intended to be human readable anyway.

sipa avatar Sep 18 '17 19:09 sipa

  • 'hrp' is now passed and returned as a String.
  • The commons.lang lib, while not part of the base language, is fairly standard. I've replaced the ArrayUtils calls by straightforward conversion code. A 'Pair' class was dropped in that is source code compatible with the commons.lang version so anyone using the classes can import 'org.apache.commons.lang3.tuple.Pair' and discard the provided 'Pair' class if so desired.
  • The only remaining 3rd party lib used is in the test harness. None are used in the bech32 classes.

SamouraiDev avatar Sep 18 '17 20:09 SamouraiDev