Class Base58


  • public class Base58
    extends java.lang.Object

    Base58 is a way to encode Bitcoin addresses as numbers and letters. Note that this is not the same base58 as used by Flickr, which you may see reference to around the internet.

    Satoshi says: why base-58 instead of standard base-64 encoding?

    • Don't want 0OIl characters that look the same in some fonts and could be used to create visually identical looking account numbers.
    • A string with non-alphanumeric characters is not as easily accepted as an account number.
    • E-mail usually won't line-break if there's no punctuation to break at.
    • Doubleclicking selects the whole number as one word if it's all alphanumeric.
    See Also:
    Original source of this class
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static char[] ALPHABET  
    • Constructor Summary

      Constructors 
      Constructor Description
      Base58()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static byte[] decode​(java.lang.String input)  
      static byte[] doubleDigest​(byte[] input)  
      static byte[] doubleDigest​(byte[] input, int offset, int length)
      Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again.
      static java.lang.String encode​(byte[] input)
      Encodes the given bytes in base58.
      • Methods inherited from class java.lang.Object

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

      • ALPHABET

        public static final char[] ALPHABET
    • Constructor Detail

    • Method Detail

      • encode

        public static java.lang.String encode​(byte[] input)
        Encodes the given bytes in base58. No checksum is appended.
      • decode

        public static byte[] decode​(java.lang.String input)
      • doubleDigest

        public static byte[] doubleDigest​(byte[] input,
                                          int offset,
                                          int length)
        Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again. This is standard procedure in Bitcoin. The resulting hash is in big endian form.