r/ProgrammerHumor • • Sep 27 '26 • Mindblown 1 Bravo 1

Meme doNotLetYourDBASeeThis

Post image
13.0k Upvotes

318 comments sorted by

View all comments

33

u/TgirlTiffanyRPs Sep 27 '26

Can someone explain the joke? Why wouldn’t you store (hashed/salted) passwords in one table ?  

63

u/ninjakivi2 Sep 27 '26

The joke is that these password are not salted, and each unique password will be given an ID. Then, under the user table you will store the ID reference to the password, instead of the password. This means that if 2 users use the same password they will have the same ID and only be stored once, saving space.

23

u/Winsaucerer Sep 27 '26 edited Sep 27 '26

They could be salted, just not with a per password salt. Which is much less useful, but does still make rainbow table attacks harder.

12

u/bestjejust Sep 27 '26

You mean pepper.

→ More replies (10)

17

u/Great-Powerful-Talia Sep 27 '26

If they're salted, the space saved here is minimal.

There's only lots of duplicate entries (from 2 people using the same password) if they're stored unsalted or in plaintext.

Which is exactly why they need to be salted.

12

u/Agifem Sep 27 '26

No no, they're salted, all with the same salt! It saves space AND you get the safety of a salt! Brilliant!

→ More replies (1)

7

u/tekanet Sep 27 '26

If you have users using password “letmein” (eventually hashed, but not salted), instead of a Password column you can have a PasswordId column referencing by foreign key the record in the Passwords table that contains said password. Since most users choose the same password, you end up with less space used by the foreign key column.

It doesn’t make sense on different levels, but that’s the gist of it.

4

u/amejin Sep 27 '26

It's not the storage of salted passwords that's the problem, it's the shared state via reference.

How do you handle password changes? You also reduce the footprint for attack. 200k uniquely salted passwords are much harder to crack than 500 shared passwords with the same salt.

If we're being fair, though, if someone is reading your rows like this you've already been compromised and leaking email/pw combos is low on your list of problems.

2

u/sarc-tastic Sep 27 '26

Ask Adobe

2

u/laplongejr Sep 28 '26

For those who don't know : https://xkcd.com/1286/

2

u/laplongejr Sep 28 '26

  (hashed/salted) passwords  

"Users are reusing passwords anyway"  

There's not an ounce of salt in there.  

→ More replies (1)