java.lang.Object
org.seppiko.commons.utils.codec.BaseNCodec
org.seppiko.commons.utils.codec.Base32
- All Implemented Interfaces:
Serializable
Base32 encoding and decoding.
- Author:
- Leonard Woo
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final charstatic final Base32The most widely used Base32 alphabet is defined in RFC 4648.static final Base32The most widely used Base32 alphabet is defined in RFC 4648.static final Base32z-base-32 is a Base32 encoding designed by Zooko Wilcox-O'Hearn to be easier for human use and more compact.Fields inherited from class org.seppiko.commons.utils.codec.BaseNCodec
MASK_4BITS, MASK_5BITS, MASK_8BITS -
Method Summary
-
Field Details
-
PADDING
protected static final char PADDING -
RFC4648
The most widely used Base32 alphabet is defined in RFC 4648. It uses an alphabet of A–Z, followed by 2–7. The digits 0, 1 and 8 are skipped due to their similarity with the letters O, I and B (thus "2" has a decimal value of 26). -
RFC4648_HEX
The most widely used Base32 alphabet is defined in RFC 4648. It uses a digit of 0-9, followed by A–V. -
ZBASE32
z-base-32 is a Base32 encoding designed by Zooko Wilcox-O'Hearn to be easier for human use and more compact. It includes 1, 8 and 9 but excludes l, v and 2. It also permutes the alphabet so that the easier characters are the ones that occur more frequently. It compactly encodes bitstrings whose length in bits is not a multiple of 8 and omits trailing padding characters. z-base-32 was used in the Mnet open source project, and is currently used in Phil Zimmermann's ZRTP protocol, and in the Tahoe-LAFS open source project.
-
-
Method Details
-
encode
Base32-encode the given data and return a newly allocated String with the result.- Specified by:
encodein classBaseNCodec- Parameters:
source- the data to encode.- Returns:
- a newly allocated String with the result.
- Throws:
NullPointerException- data is null.
-
decode
Decode the Base32-encoded data in input and return the data in a new byte array.- Specified by:
decodein classBaseNCodec- Parameters:
str- the data to decode.- Returns:
- the data in a new byte array.
- Throws:
NullPointerException- data is null.IllegalArgumentException- data is not divisible by 8.
-