mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-28 07:21:07 +00:00
12 lines
334 B
Python
12 lines
334 B
Python
|
import base64
|
||
|
|
||
|
def main():
|
||
|
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)
|
||
|
print(base64.b16decode(b16encoded).decode('utf-8'))#decoded it
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|