Class Bech32Util


  • public class Bech32Util
    extends java.lang.Object
    following code is copied from bitcoinJ and https://github.com/sipa/bech32/pull/40/
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String HRP  
    • Constructor Summary

      Constructors 
      Constructor Description
      Bech32Util()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decodeAddress​(java.lang.String address, java.lang.String hrp_prefix)
      decode Bech32 address
      static java.lang.String encodeAddress​(byte[] code, java.lang.String hrp_prefix)
      encode address data with pre-set hrp
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • HRP

        public static final java.lang.String HRP
    • Constructor Detail

      • Bech32Util

        public Bech32Util()
    • Method Detail

      • decodeAddress

        public static byte[] decodeAddress​(java.lang.String address,
                                           java.lang.String hrp_prefix)
        decode Bech32 address
        Parameters:
        address - bech32 address
        hrp_prefix - hrp prefix, if null, use default
        Returns:
        address contains in bech32 format
      • encodeAddress

        public static java.lang.String encodeAddress​(byte[] code,
                                                     java.lang.String hrp_prefix)
        encode address data with pre-set hrp
        Parameters:
        code - raw address data
        hrp_prefix - hrp prefix, if null, use default
        Returns:
        bech32 address