base32
Module with helper class for Base32.
- class Base32Const
Bases:
object
Class container for Base32 constants.
- ALPHABET: str = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
- PADDING_CHAR: str = '='
- class Base32Decoder
Bases:
object
Base32 decoder class. It provides methods for decoding to Base32 format.
- static Decode(data: str, custom_alphabet: Optional[str] = None) bytes
Decode from Base32.
- Parameters:
data (str) – Data
custom_alphabet (str, optional) – Custom alphabet string
- Returns:
Decoded bytes
- Return type:
bytes
- Raises:
ValueError – If the Base32 string is not valid
- class Base32Encoder
Bases:
object
Base32 encoder class. It provides methods for encoding to Base32 format.
- static Encode(data: Union[bytes, str], custom_alphabet: Optional[str] = None) str
Encode to Base32.
- Parameters:
data (str or bytes) – Data
custom_alphabet (str, optional) – Custom alphabet string
- Returns:
Encoded string
- Return type:
str
- static EncodeNoPadding(data: Union[bytes, str], custom_alphabet: Optional[str] = None) str
Encode to Base32 by removing the final padding.
- Parameters:
data (str or bytes) – Data
custom_alphabet (str, optional) – Custom alphabet string
- Returns:
Encoded string
- Return type:
str