Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert plain text password into PBKDF2 algorithm format in Django?

I have list user information that I am pulling from some other database tool. The information in this tool is in plain text. I am using Django for my project and I need passowrd into <algorithm>$<iterations>$<salt>$<hash> format.

Which library or script that I can use to convert my plaintext to Hashed value ?

I have read about Django Hasher but wanted to get more information about it.


1 Answers

If you are gonna save the password in a user model, just call user.set_password(<plain-text password>) on the instance. Otherwise, use make_password():

from django.contrib.auth.hashers import make_password

hashed_pass = make_password(plain_text_pass)
like image 77
knbk Avatar answered Sep 03 '25 00:09

knbk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!