> For the complete documentation index, see [llms.txt](https://openai.gitbook.io/code-cheatsheets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openai.gitbook.io/code-cheatsheets/all/python/packages/passwords.md).

# PassLib

* Supports many hashing types with simple interface

`pip install passlib`

```python
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'

pbkdf2_sha256.verify("toomanysecrets", hash)
#True
pbkdf2_sha256.verify("joshua", hash)
#False
```

## Alternatives

* Werkzeug.security
* Bcrypt
