Class Base58

java.lang.Object
org.xrpl.xrpl4j.codec.addresses.Base58
Direct Known Subclasses:
AddressBase58

public class Base58 extends Object
Utility class for encoding and decoding in Base58. Includes methods for encoding and decoding with a 4 byte checksum, which is necessary for XRPL Address encoding.
  • Field Details

    • ALPHABET

      public static final char[] ALPHABET
  • Constructor Details

    • Base58

      public Base58()
  • Method Details

    • encode

      public static String encode(byte[] input)
      Encodes the given bytes to a Base58 String.
      Parameters:
      input - A byte array to encode.
      Returns:
      The bytes encoded to a Base58 String
    • decode

      public static byte[] decode(String input)
      Decodes a Base58 encoded String to a byte array.
      Parameters:
      input - The Base58 String.
      Returns:
      A byte array containing the decoded Base58 String.
    • encodeChecked

      public static String encodeChecked(byte[] bytes)
      Encodes the given byte array to a Base58 String with a 4 byte checksum appended.
      Parameters:
      bytes - The byte array to encode.
      Returns:
      A String containing the Base58Check encoded bytes.
    • decodeChecked

      public static byte[] decodeChecked(String input) throws EncodingFormatException
      Decodes the given Base58Check encoded String to a byte array, and validates the checksum.
      Parameters:
      input - A Base58Check encoded String.
      Returns:
      A byte array containing the decoded value.
      Throws:
      EncodingFormatException - If the input is not Base58 encoded or the checksum does not validate.