15
you are viewing a single comment's thread
view the rest of the comments
[-] Xandris@kbin.social 0 points 1 year ago
[-] Downcount@lemmy.world 1 points 1 year ago

Yeah, you actually better not save the users passwords in plain text or in an encrypted way it could be decrypted. You rather save a (salted) hashed string of the password. When a user logs in you compare the hashed value of the password the user typed in against the hashed value in your database.

What is hashed? Think of it like a crossfoot of a number:

Let's say you have a number 69: It's crossfoot is (6+9) 15. But if someone steals this crossfoot they can't know the original number it's coming from. It could be 78 or 87.

[-] twolate@discuss.tchncs.de 1 points 1 year ago

Dumb question: isn't it irrelevant for the malicous party if it's 78 or 87 per your example, because the login only checks the hash anyway? Won't both numbers succesfully login?

[-] foudinfo@jlai.lu 1 points 1 year ago

It's actually a really good question. What you're explaining is called a collision, by creating the same hash with different numbers you can succesfully login.

This why some standard hashing function become deprecated and are replaced when someone finds a collision. MD5, which was used a lot to hash passwords or files, is considered insecure because of all the collisions people could find.

load more comments (4 replies)
load more comments (5 replies)
load more comments (5 replies)
this post was submitted on 17 Jul 2023
15 points (94.1% liked)

Programmer Humor

32050 readers
1602 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS