我想每次都为相同的 msg 生成一致的加密结果。目前,我得到了不同的加密结果。
我正在做这样的事情
from cryptography.fernet import Fernet
key = Fernet.generate_key()
f = Fernet(key)
token = f.encrypt(b"A really secret message. Not for prying eyes.")
print(token)
# b'gAAAAABfh2ghAoFbQ_MUqdTAs7n__Pz2cOkDeYuMbDOGFa6NSL3Ld_seLIPOs4ztvTW888Y_1CSrFlk_mioSe-rP5TVhFXFfwHYTiLQ4ldTlttXWwoACQhjsMR5vPEWQcEj_5oEWmciV'
token = f.encrypt(b"A really secret message. Not for prying eyes.")
print(token)
# b'gAAAAABfh2gh56xzic644KRb0MEXuttUAEtFGH3ewdblPK40biRuZ7iQcGBVQ4XT9uLrFFSHsiWl9Tdyl2TAyzGwMqHFUcrA0ZO4qqTTKp364UY6tcwcnF2JSLc0hGPjcX5bqD5Ghpn0'
token = f.encrypt(b"A really secret message. Not for prying eyes.")
print(token)
# b'gAAAAABfh2gho82P0yCC9KagQnLO0QrPm2sQBcWeiVFx45IP2IZlTyB0bfZPubu1NAYZ1aQ6S4DoASU7vMqzrd8Bbe9hicFjXwPSBKMzVWkf_BLZZNqoB4EdeOE0x5NQGB-aEctzPfEZ'
我希望每次输入字符串都是相同的标记时,结果应该是相同的。另外,如果有更好更简单的插件,请推荐。