public class Base58
extends java.lang.Object
Note that this is not the same base58 as used by Flickr, which you may find referenced around the Internet.
Satoshi explains: why base-58 instead of standard base-64 encoding?
However, note that the encoding/decoding runs in O(n²) time, so it is not useful for large data.
The basic idea of the encoding is to treat the data bytes as a large number represented using base-256 digits, convert the number to be represented using base-58 digits, preserve the exact number of leading zeros (which are otherwise lost during the mathematical operations on the numbers), and finally represent the resulting base-58 digits as alphanumeric ASCII characters.
| Modifier and Type | Field and Description |
|---|---|
static char[] |
ALPHABET |
| Constructor and Description |
|---|
Base58() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
base58CheckDecode(java.lang.String input) |
static java.lang.String |
base58CheckEncode(byte[] data) |
static byte[] |
decode(java.lang.String input)
Decodes the given base58 string into the original data bytes.
|
static java.math.BigInteger |
decodeToBigInteger(java.lang.String input) |
static java.lang.String |
encode(byte[] input)
Encodes the given bytes as a base58 string (no checksum is appended).
|
public static java.lang.String encode(byte[] input)
input - the bytes to encodepublic static byte[] decode(java.lang.String input)
throws AddressFormatException
input - the base58-encoded string to decodeAddressFormatException - if the given string is not a valid base58 stringpublic static java.math.BigInteger decodeToBigInteger(java.lang.String input)
throws AddressFormatException
AddressFormatExceptionpublic static java.lang.String base58CheckEncode(byte[] data)
public static byte[] base58CheckDecode(java.lang.String input)