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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
Decodes a Base58 encodedString
to a byte array.static byte[]
decodeChecked
(String input) Decodes the given Base58Check encodedString
to a byte array, and validates the checksum.static String
encode
(byte[] input) Encodes the given bytes to a Base58String
.static String
encodeChecked
(byte[] bytes) Encodes the given byte array to a Base58String
with 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 encodedString
to a byte array. -
encodeChecked
Encodes the given byte array to a Base58String
with a 4 byte checksum appended.- Parameters:
bytes
- The byte array to encode.- Returns:
- A
String
containing the Base58Check encoded bytes.
-
decodeChecked
Decodes the given Base58Check encodedString
to 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.
-