python base64库介绍
生活随笔
收集整理的這篇文章主要介紹了
python base64库介绍
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
實例代碼,
import base64str1='you_know_how_to_remove_junk_code'flag=''for i in str1:flag += chr(ord(i)^0x25)print(base64.b64encode(flag)) #將flag字符串加密base64.bxxencode() 加密語句
base64.bxxdecode() 解密語句
實例:
# base64編碼 t = base64.b64encode(s.encode('UTF-8')) print(t)# base64解碼 t = base64.b64decode(t) print(t)# base32編碼 t = base64.b32encode(s.encode('UTF-8')) print(t)# base32解碼 t = base64.b32decode(t) print(t)總結
以上是生活随笔為你收集整理的python base64库介绍的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 解决php文件包含的问题;Web_php
- 下一篇: websocket python爬虫_p