|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectccs.utils.Base32Encoder
public class Base32Encoder
Encodes and decodes "base32" encoded binaries. Base64 is well known, and is used to transmit binary data over 7 bit links or via mechanisms which are intended for text. Base32 is intended to encode binary via links which involve human interaction; in particular, things like registration keys. The intent is that base32 uses its narrower repertoire to provide better immunity to typos.
Base32 works with a 40-bit quantum (5 octets). To encode, each quantum is split into 8 groups of 5 bits. Each 5-bit group is encoded into an ASCII character as follows:
Decoding is similar. However, to make the scheme more tolerant of transcription errors, the following extra rules apply.
Currently (and unlike base64) base32 does not support arbitrary-length inputs: inputs must be multiples of 5 octets. A future version of the specification might fix this: it is expected that such a version would use '=' as pad characters, as does base64.
Constructor Summary | |
---|---|
Base32Encoder()
|
Method Summary | |
---|---|
static byte[] |
decode(java.lang.String src)
Decode a base32-encoded character string into an octet-string. |
static java.lang.String |
encode(byte[] wad)
|
static java.lang.String |
encode(byte[] wad,
int off,
int len)
Encode an octet string into a base32 character string. |
static java.lang.String |
toHashableString(java.lang.String src)
Returns a "hashing friendly" version of the supplied string. |
static java.lang.String |
toString(byte[] wad)
Returns a "user-friendly" version of the encoded octet-string. |
static java.lang.String |
toString(byte[] wad,
int off,
int len)
Returns a "user-friendly" version of the encoded octet-string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Base32Encoder()
Method Detail |
---|
public static java.lang.String encode(byte[] wad)
public static java.lang.String encode(byte[] wad, int off, int len)
wad
- The input.off
- The offset in wad
of the first octet to encodelen
- The length. This must be divisible by 5.public static byte[] decode(java.lang.String src)
java.lang.IllegalArgumentException
- If the input does not contain
a multiple of 8 valid characters (ie. characters which are not
cruft).public static java.lang.String toString(byte[] wad)
public static java.lang.String toString(byte[] wad, int off, int len)
public static java.lang.String toHashableString(java.lang.String src)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |