public final class Base32
- Object
- Base32
Base32 encoder/decoder per RFC 4648. Mostly useful for OTP shared secrets, which are conventionally distributed as Base32 strings (the format embedded in QR codes by authenticator apps).
Example
byte[] secret = Base32.decode("JBSWY3DPEHPK3PXP");
String enc = Base32.encode(secret);
Methods
public static String encode(byte[] data) | Encodes the bytes as a Base32 string (uppercase, with = padding). |
public static byte[] decode(String s) | Decodes a Base32 string. |
Inherited methods
Method details
encode
public static String encode(byte[] data)Encodes the bytes as a Base32 string (uppercase, with
= padding).decode
public static byte[] decode(String s)Decodes a Base32 string. Padding and whitespace are tolerated; mixed
case is accepted.