java.lang.Object
com.irurueta.authserver.authorization.domain.totp.Base32

public final class Base32 extends Object
Base32 encoding (RFC 4648) without padding, the form authenticator applications expect for a shared secret.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final String
    The Base32 alphabet.
    private static final int
    Bits carried by each byte.
    private static final int
    Bits carried by each character.
    private static final int
    Mask selecting the bits of one byte, to read it as unsigned.
    private static final int
    Mask selecting the bits of one character.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Not instantiable: a holder of static helpers.
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    encode(byte[] data)
    Encodes bytes.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ALPHABET

      private static final String ALPHABET
      The Base32 alphabet.
      See Also:
    • BITS_PER_BYTE

      private static final int BITS_PER_BYTE
      Bits carried by each byte.
      See Also:
    • BITS_PER_CHAR

      private static final int BITS_PER_CHAR
      Bits carried by each character.
      See Also:
    • BYTE_MASK

      private static final int BYTE_MASK
      Mask selecting the bits of one byte, to read it as unsigned.
      See Also:
    • CHAR_MASK

      private static final int CHAR_MASK
      Mask selecting the bits of one character.
      See Also:
  • Constructor Details

    • Base32

      private Base32()
      Not instantiable: a holder of static helpers.
  • Method Details

    • encode

      public static String encode(byte[] data)
      Encodes bytes.
      Parameters:
      data - the bytes to encode; must not be null.
      Returns:
      the encoded text, upper case and without padding.