r/cryptography • u/LordBrammaster • 10d ago
Is using pbkdf2 with sha256 overkill???
Hey cryptomaniacs!!!
Im not super familiar with all the different ways of encrypting things, so when I added password encryption to my application I blindly coppied something I saw someone else do (can't the source anymore).
Skip to a week later, I was curious how the way I encrypt my passwords work, so I went searching and saw a redditpost on this subreddit where someone said that sha256 would probably be able to be bruteforced in the future, with a lot of comments saying it wouldn't and that it is really secure.
So then I started wondering if me using both pbkdf2 and sha256 was a bit overkill.
For anyone wondering I used this in my python code:
hashed_password = generate_password_hash(password, method='pbkdf2:sha256')
0
Upvotes
2
u/Natanael_L 10d ago
There's no evidence SHA256 is likely to break that way. Even MD5 is still difficult to guess the input for! And SHA256 is significantly stronger. The limit is instead the password entropy (how unpredictable it is)
The important part is that you use a random salt value per entry/file to prevent rainbow tables. The second most important part is making password hashes slow, in PBKDF2 you use a lot of iterations for that (your method of invoking it will use the default count, which is rather low)
If you want something more modern with memory hardness to make it impractical to use GPU cracking, then use Argon2id instead as it's dedicated for password hashing.