Package net.i2p.data
Class Base32
java.lang.Object
net.i2p.data.Base32
public class Base32 extends Object
Encodes and decodes to and from Base32 notation.
Ref: RFC 3548
Don't bother with '=' padding characters on encode or
accept them on decode (i.e. don't require 5-character groups).
No whitespace allowed.
Decode accepts upper or lower case.
- Since:
- 0.7
- Author:
- zzz
-
Method Summary
Modifier and Type Method Description static byte[]
decode(String s)
Case-insensitive.static String
decodeToString(String s)
Decodes data from Base32 notation and returns it as a string.static String
encode(byte[] source)
Returns lower case.static String
encode(String source)
Returns lower case.static void
main(String[] args)
-
Method Details
-
main
-
encode
Returns lower case. Does not add trailing '='.- Parameters:
source
- if null will return ""
-
encode
Returns lower case. Does not add trailing '='.- Parameters:
source
- The data to convert non-null
-
decodeToString
Decodes data from Base32 notation and returns it as a string. Case-insensitive. Does not allow trailing '='.- Parameters:
s
- the string to decode, if null returns null- Returns:
- The data as a string or null on failure
-
decode
Case-insensitive. Does not allow trailing '='.- Parameters:
s
- non-null- Returns:
- decoded data, null on error
-