I want to store a password using python and then re-use it . I want to store a password using python and then re-use it . How can I do this in a secured way ?
Asked
Active
Viewed 84 times
0
-
Why do you copy your first sentence verbatim in the second? :) – Willem Van Onsem Jan 28 '17 at 20:12
1 Answers
0
Searching around I found this: 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

Pablo Reyes
- 3,073
- 1
- 20
- 30