Coding and decoding Base64 in Python

Base64 coding is a kind of coding method of “guard against gentleman but not villain”. It is widely used in MIME Protocol. As the transmission code of e-mail, the generated code is reversible. The last two bits may have “=”, and the generated codes are all ASCII characters.
Advantages: fast speed, ASCII characters, incomprehensible to the naked eye
disadvantages: the encoding is relatively long, very easy to crack, only suitable for the occasion of encrypting non key information
Base64 encoding and decoding in Python
& gt; & gt; & gt; import Base64
& gt; & gt; s =’I am a string ‘
& gt; & gt; a = Base64. B64encode (s)
& gt; & gt; & gt; Print a
ztlkx9fwt / u0rg = =
& gt; & gt; & gt; print Base64. B64decode (a)
I am a string

Read More: