Python/ciphers/base16.py

14 lines
343 B
Python
Raw Normal View History

import base64
2019-10-05 05:14:13 +00:00
def main():
2019-10-05 05:14:13 +00:00
inp = input("->")
encoded = inp.encode("utf-8") # encoded the input (we need a bytes like object)
b16encoded = base64.b16encode(encoded) # b16encoded the encoded string
print(b16encoded)
2019-10-05 05:14:13 +00:00
print(base64.b16decode(b16encoded).decode("utf-8")) # decoded it
2019-10-05 05:14:13 +00:00
if __name__ == "__main__":
main()