喜歡就扣1支持吧
加密
base64.b64encode(字節類型)
解密
base64.b64decode(加密字符串)
import base64
string1 = "hello world"
# 需要轉成2進制格式纔可以轉換
result = base64.b64encode(string1.encode())
print('加密:'+str(result))
# 再把加密後的結果解碼
string2 = base64.b64decode(result)
# 解碼後的結0果是二進制,需要轉換
print('解密:'+string2.decode())