[PYTHON] Understand base64.

What is base64

base64 is a word that means base64, and all data is encoded by 64 letters of alphabet (a ~ z, A ~ z), numbers (0 ~ 9), and some symbols (+, /). It is a method.

What is base64? ?? I implemented it for understanding

Relationship diagram

base64.jpeg

#String"Hello"Encode
encoded="Hello".encode()
print(encoded)
#b'Hello'

#-----------------
#"Hello"Base64 encoding Bytes
base64_encoded=base64.b64encode(encoded)
print(base64_encoded)
#b'SGVsbG8='

#-----------------
#Decode base64 encoded Bytes
decoded=base64.b64decode(base64_encoded)
print(decoded)
#b'Hello'

#-----------------
#Decode Bytes
string=decoded.decode()
print(string)
#'Hello'

reference

What is base64? ?? I implemented it for understanding Mutual conversion and hexadecimal display of strings and bytes in Python 3 base64 --- Base16, Base32, Base64, Base85 Data Encoding

Recommended Posts

Understand base64.
Understand Word2Vec
Understand k-means ++
Base number
Base64 decode / encode
Understand numpy's axis