import base64
copyright = 'Copyright (c) 2012 Doucube Inc. All rights reserved.'
def main():
#轉成bytes string
bytesString = copyright.encode(encoding="utf-8")
print(bytesString)
#base64 編碼
encodestr = base64.b64encode(bytesString)
print(encodestr)
print(encodestr.decode())
#解碼
decodestr = base64.b64decode(encodestr)
print(decodestr.decode())
if __name__ == '__main__':
main()
Python全棧•基礎(一)⁃Python3 base64算法加密解密
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.