conversions.base64_to_binary

References for better understanding: https://en.wikipedia.org/wiki/Base64

Attributes

B64_TO_BITS

Functions

base64_to_bin(→ str)

Convert a base64 value to its binary equivalent.

Module Contents

conversions.base64_to_binary.base64_to_bin(base64_str: str) str

Convert a base64 value to its binary equivalent.

>>> base64_to_bin("ABC")
'000000000001000010'
>>> base64_to_bin("    -abc    ")
'-011010011011011100'
>>> base64_to_bin("    a-bc    ")
Traceback (most recent call last):
  ...
ValueError: Invalid base64 string. Invalid char - at pos 1
>>> base64_to_bin("")
Traceback (most recent call last):
  ...
ValueError: Empty string was passed to the function
conversions.base64_to_binary.B64_TO_BITS