如何在Python中加密密码,加密密码会将密码编码为随机字符序列。使用base64.b64encode()加密密码
如何在Python中加密密码
加密密码会将密码编码为随机字符序列。
使用base64.b64encode()加密密码
password = "my_password".encode("utf-8") encoded = base64.b64encode(password) print(encoded) decoded = base64.b64decode(encoded) print(decoded)
输出:
b'bXlfcGFzc3dvcmQ=' b'my_password'
发表评论