Python之base64加密解密

Python之base64加密解密

加密:

import base64
str1 = "hello word"
str2 = str1.encode(encoding ='utf-8',errors = 'strict')
str3 = base64.b64encode(str2)
str4 = str3.decode()

解密:

enstr = base64.b64decode(str3.decode())
print(enstr.decode())
posted @ 2022-04-24 15:33  南瓜头pumpkin  阅读(43)  评论(0)    收藏  举报