passlib is a Python library for key derivation and hashing functions
Questions tagged [passlib]
50 questions
7
votes
1 answer
How does CryptContext hashing know what secret to use?
I have the following code snippet:
from passlib.context import CryptContext
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
pwd_context.hash(password)
Which is described here.
What i don't understand is, how can this be secure if…

supersick
- 261
- 2
- 14
5
votes
1 answer
Can't import passlib into python3
Trying to import passlib into python3 and it fails:
$ pip freeze | grep lib
passlib==1.6.5
$ python3
Python 3.4.2 (default, Oct 8 2014, 10:45:20)
>>> import passlib
Traceback (most recent call last):
File "", line 1, in…

Aladine
- 185
- 3
- 16
4
votes
1 answer
ModuleNotFoundError: No module named 'passlib' despite passlib already being installed
I have a python module that tries to import from passlib.hash import pbkdf2_sha256, however when running the module, I get the ModuleNotFoundError.
I have tried running the module in my base environment, a venv, in a poetry shell, and I've tried…

Chris
- 126
- 1
- 2
- 9
3
votes
2 answers
Alembic not handling column_types.PasswordType : Flask+SQLAlchemy+Alembic
Background
I'm trying to use a PostgreSQL back-end instead of Sqlite in this Flask + RESTplus server example.
I faced an issue with the PasswordType db column type. In order to make it work, I had to change the following code in…

patlachance
- 101
- 1
- 6
3
votes
1 answer
Check password hash created by Django in Flask
I have a password hash generated by Django. I want to log in a user with this password hash from Flask. How can I verify the password in Flask?
from django.contrib.auth import hashers
hash = hashers.make_password('pasword')
#…

Sung Jin O
- 171
- 1
- 2
- 10
1
vote
1 answer
ModuleNotFoundError: No module named 'passlib', even after pip installing and pipenv installing
So I know, it seems this question has been asked before, but I do believe I have a unique situation.
I'm developing a Flask app (specifics below). I've created a virtual environment with pipenv.
But no matter what I try, I keep getting this…

Alex van Winkel
- 43
- 6
1
vote
1 answer
Is this a bug in the passlib base64 encoding?
I am trying to decode an re-encode a bytesytring using passlibs base64 encoding:
from passlib.utils import binary
engine = binary.Base64Engine(binary.HASH64_CHARS)
s2 =…

HerpDerpington
- 3,751
- 4
- 27
- 43
1
vote
1 answer
Securely implementing two factor authentication in flask
I have flask-login and an SQLAlchemy db to authenticate user login attempts. But merging username and password inputs with a token-based totp has been the point of my problem. I'm using passlib to manage the totp authentication which has a token…

Dinil Fernando
- 35
- 1
- 8
1
vote
0 answers
Use custom Base_64 dictionary for passlib.hash.scrypt
Is it possible to specify a custom Base_64 dictionary when encoding data within passlib?
I have a requirement to generate 'scrypt' encoded passwords on a system that does not allow the '+' character within its configuration files.
More specifically…

HazyMaze
- 23
- 4
1
vote
1 answer
How to ensure RNG entropy pool is "secure and full" for generating passwords with passlib?
When looking at using Python's passlib module, the documentation[1] comes with a warning for generating passwords which reads..
Warning: Before using these routines, make sure your system’s RNG
entropy pool is secure and full. Also make sure that…

gratz
- 1,506
- 3
- 16
- 34
1
vote
0 answers
How to fix length of hashed value in passlib context python?
I am using below code for encrypting password.
from passlib.context import CryptContext
pwd_context = CryptContext(
schemes=["pbkdf2_sha256"],
default="pbkdf2_sha256",
pbkdf2_sha256__default_rounds=30000
)
def…

Urvi Soni
- 314
- 1
- 2
- 12
1
vote
1 answer
Using PassLib to Verify Hash from Flask User Passwords
I'm currently trying to migrate my Flask Users over to a Django Backend.
However, when I'm using passlib to verify the hash, I can't figure out why it won't verify.
Our flask app settings
SECURITY_PASSWORD_HASH =…

yrekkehs
- 727
- 1
- 8
- 15
1
vote
1 answer
ValueError: malformed sha1_crypt hash (checksum must be exactly 28 chars)
I am new to programming and to learn I tried to make an authentification program that stores password and usernames in .txt files using passlib:
But I am getting this error when I try to verify my hashed password in my password.txt file:`Traceback…

Thewizy
- 11
- 5
1
vote
1 answer
ValueError: not a valid sha256_crypt hash when verifying hashed password during login
I get a server 500 error in my flask-app when trying to verify the user password.
I'm running two identical flask-apps one on my local ubuntu system and one on a linode server.
On the local system I run it on the built in development server, on the…

RogerB
- 74
- 1
- 7
1
vote
1 answer
expected sha256_crypt hash, got sha256_crypt config string instead
Im getting the following error expected sha256_crypt hash, got sha256_crypt config string instead.
expected sha256_crypt hash, got sha256_crypt config string instead
This is my code what am i doing wrong?
code :
@app.route('/login' ,…

Tim Boom
- 11
- 1