public class Base32
extends java.lang.Object
Constructor and Description |
---|
Base32() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
bitSetToByteArray(java.util.BitSet bs,
int numBits)
This function will take a BitSet, whose byte order is LSB->MSB, and create a byte[] whose bytes are in the same
order.
|
static java.util.BitSet |
decode(java.lang.String s)
Takes string s, which should be a number encoded in Base32.
|
static java.lang.String |
encode(java.util.BitSet bits,
int nbits)
This function takes a BitSet, whose LSB is in position 0 and whose MSB is in position length-1, and turns it into
a Base32 string whose endianness is opposite, MSB-LSB, similar to how one would write a hex string.
|
static java.lang.String |
encode(byte[] bytes)
This function will encode the byte array 'bytes' into a Base-32 formatted string using charactors 1-9, A-X,
skipping zero and 'O'.
|
static char |
getChar(int i) |
static boolean |
ithBitSet(byte b,
int i) |
public static java.lang.String encode(byte[] bytes)
bytes
- an array of bytes. Note that the bytes in the lower indices will be treated as lower significance.
So, {0xab, 0xcd, 0xef} will be the hex number 0xefcdabpublic static java.lang.String encode(java.util.BitSet bits, int nbits)
bits
- numBits
- public static java.util.BitSet decode(java.lang.String s)
public static byte[] bitSetToByteArray(java.util.BitSet bs, int numBits)
bs
- the LSB->MSB bit set to convert.numBits
- The number of bits in the bit set to process.public static boolean ithBitSet(byte b, int i)
public static char getChar(int i)