[英]Store and resue password in python
I want to store a password using python and then re-use it . 我想使用python存储一个密码,然后重新使用它。 I want to store a password using python and then re-use it . 我想使用python存储一个密码,然后重新使用它。 How can I do this in a secured way ? 我该如何以安全的方式执行此操作?
Searching around I found this: PassLib . 我四处搜索发现: PassLib 。 You can pip install it 你可以点安装
pip install passlib
And then use it. 然后使用它。 This is from the example in their link. 这来自他们链接中的示例。
>>> # import the hash algorithm
>>> from passlib.hash import pbkdf2_sha256
>>> # generate new salt, and hash a password
>>> hash = pbkdf2_sha256.hash("toomanysecrets")
>>> hash
'$pbkdf2-sha256$29000$N2YMIWQsBWBMae09x1jrPQ$1t8iyB2A.WF/Z5JZv.lfCIhXXN33N23OSgQYThBYRfk'
>>> # verifying the password
>>> pbkdf2_sha256.verify("toomanysecrets", hash)
True
>>> pbkdf2_sha256.verify("joshua", hash)
False
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.