Class Base32


  • public class Base32
    extends Object
    Author:
    Werner Dittmann <Werner.Dittmann@t-online.de>
    • Constructor Detail

      • Base32

        public Base32()
    • Method Detail

      • divceil

        public static int divceil​(int a,
                                  int b)
      • binary2ascii

        public static String binary2ascii​(byte[] os,
                                          int lengthInBits)
        Encode binary data into a Base32 string. The method returns a string that contains the base32 encoded data.
        Parameters:
        os - The byte array containing the binary data. The length must be at least (lengthInBits + 7) / 8 .
        lengthInBits - Defines how may bits of the binary data shall be encoded into a base32 string.
        Returns:
        The string containing the base32 encoded data.
      • ascii2binary

        public static byte[] ascii2binary​(String cs,
                                          int lengthInBits)
        Decode a Base32 string into binary data. The method returns a byte array that contains the binary data that was decoded from the base32 string.
        Parameters:
        cs - The String containing the base32 data. The length must be at least (lengthInBits + 5 - 1) / 5 characters .
        lengthInBits - Defines how may bits shall be decoded from the String.
        Returns:
        The byte array containg the decoded data.