Package dev.uni_hamburg.security.otp.api
Class Base32
- java.lang.Object
-
- dev.uni_hamburg.security.otp.api.Base32
-
public class Base32 extends Object
Encodes arbitrary byte arrays as case-insensitive base-32 strings. The implementation is slightly different than in RFC 4648. During encoding, padding is not added, and during decoding the last incomplete chunk is not taken into account. The result is that multiple strings decode to the same byte array, for example, string of sixteen 7s ("7...7") and seventeen 7s both decode to the same byte array. TODO(sarvar): Revisit this encoding and whether this ambiguity needs fixing.- Author:
- sweis@google.com (Steve Weis), Neal Gafter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBase32.DecodingException
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static byte[]decode(String encoded)protected byte[]decodeInternal(String encoded)static Stringencode(byte[] data)protected StringencodeInternal(byte[] data)static Stringrandom()
-
-
-
Constructor Detail
-
Base32
protected Base32(String alphabet)
-
-
Method Detail
-
decode
public static byte[] decode(String encoded) throws Base32.DecodingException
- Throws:
Base32.DecodingException
-
decodeInternal
protected byte[] decodeInternal(String encoded) throws Base32.DecodingException
- Throws:
Base32.DecodingException
-
encode
public static String encode(byte[] data)
-
encodeInternal
protected String encodeInternal(byte[] data)
-
random
public static String random()
-
-