📜  fernet 从密码生成密钥 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:32.185000             🧑  作者: Mango

代码示例1
from hashlib import scrypt
from os import urandom
from base64 import urlsafe_b64encode

salt = urandom(16)
key = scrypt(b'password', salt=salt, n=16384, r=8, p=1, dklen=32)
key_encoded = urlsafe_b64encode(key)