mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-01-31 06:33:44 +00:00
base64
added b64
This commit is contained in:
parent
261d721b22
commit
fde422e217
11
ciphers/base64_cipher.py
Normal file
11
ciphers/base64_cipher.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
import base64
|
||||
|
||||
def main():
|
||||
inp = input('->')
|
||||
encoded = inp.encode('utf-8') #encoded the input (we need a bytes like object)
|
||||
b64encoded = base64.b64encode(encoded) #b64encoded the encoded string
|
||||
print(b64encoded)
|
||||
print(base64.b64decode(b64encoded).decode('utf-8'))#decoded it
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
Loading…
Reference in New Issue
Block a user