Python/ciphers/base32.py
Dhruv Manilawala 14bcb580d5
fix(mypy): Fix annotations for 13 cipher algorithms (#4278)
* Initial fix for mypy errors in some cipher algorithms

* fix(mypy): Update type hints

* fix(mypy): Update type hints for enigma_machine2.py

* Update as per the suggestion

Co-authored-by: Christian Clauss <cclauss@me.com>

Co-authored-by: Christian Clauss <cclauss@me.com>
2021-03-22 07:59:51 +01:00

14 lines
351 B
Python

import base64
def main() -> None:
inp = input("->")
encoded = inp.encode("utf-8") # encoded the input (we need a bytes like object)
b32encoded = base64.b32encode(encoded) # b32encoded the encoded string
print(b32encoded)
print(base64.b32decode(b32encoded).decode("utf-8")) # decoded it
if __name__ == "__main__":
main()