Package org.xrpl.xrpl4j.codec.addresses
Class Base58
java.lang.Object
org.xrpl.xrpl4j.codec.addresses.Base58
- Direct Known Subclasses:
AddressBase58
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 Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]Decodes a Base58 encodedStringto a byte array.static byte[]decodeChecked(String input) Decodes the given Base58Check encodedStringto a byte array, and validates the checksum.static Stringencode(byte[] input) Encodes the given bytes to a Base58String.static StringencodeChecked(byte[] bytes) Encodes the given byte array to a Base58Stringwith a 4 byte checksum appended.
-
Field Details
-
ALPHABET
public static final char[] ALPHABET
-
-
Constructor Details
-
Base58
public Base58()
-
-
Method Details
-
encode
Encodes the given bytes to a Base58String.- Parameters:
input- A byte array to encode.- Returns:
- The bytes encoded to a Base58
String
-
decode
Decodes a Base58 encodedStringto a byte array. -
encodeChecked
Encodes the given byte array to a Base58Stringwith a 4 byte checksum appended.- Parameters:
bytes- The byte array to encode.- Returns:
- A
Stringcontaining the Base58Check encoded bytes.
-
decodeChecked
Decodes the given Base58Check encodedStringto a byte array, and validates the checksum.- Parameters:
input- A Base58Check encodedString.- Returns:
- A byte array containing the decoded value.
- Throws:
EncodingFormatException- If the input is not Base58 encoded or the checksum does not validate.
-