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 encrypt_password(password):
return pwd_context.encrypt(password)
def check_encrypted_password(password, hashed):
return pwd_context.verify(password, hashed)
When I call encrypt_password('password')
function it will encrypt my password into hash value and give me output as follow..
'$pbkdf2-sha256$30000$X6vVGgNgzFmrlVIq5RyjVA$VGQ5x.yuabpdNMDMNc1S3/umqXMl3605DyjJ/lgXAM0'
The output of encypted password hashed value is too long value. I want to get output in fixed sized like "30 characters or 40 characters". How to get fix sized output.? Can anyone help me to understand this.
Thank You !