str = <span style="color: #800000;">'<span style="color: #800000;">cnblogs<span style="color: #800000;">'<span style="color: #000000;">
str64 =<span style="color: #000000;"> base64.b64encode(str)
<span style="color: #0000ff;">print str64 <span style="color: #008000;">#<span style="color: #008000;">Y25ibG9ncw==
<span style="color: #0000ff;">print base64.b64decode(str64) <span style="color: #008000;">#<span style="color: #008000;">cnblogs
二、MD5
hashlib.md5(<span style="color: #008000;">#<span style="color: #008000;">Python 3.x
<span style="color: #0000ff;">import<span style="color: #000000;"> hashlib
<span style="color: #0000ff;">print(hashlib.md5(<span style="color: #800000;">"<span style="color: #800000;">whatever your string is<span style="color: #800000;">".encode(<span style="color: #800000;">'<span style="color: #800000;">utf-8<span style="color: #800000;">')).hexdigest())