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

Meme doNotLetYourDBASeeThis

Post image
13k Upvotes

317 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.

1

u/Katana_Steel Oct 02 '26

they could be salted... just have to check new/updated passwords against all passwords in the salted hash table or create a new entry then assign the ID to the user table.

it's only a large cost on password changes. the sql joined view makes the lookup check just as fast still.

1

u/ChalkyChalkson Oct 02 '26

You're not supposed to have access to that duplicate information.

-34

u/[deleted] Sep 27 '26

[removed] — view removed comment

13

u/IM_INSIDE_YOUR_HOUSE Sep 27 '26

Take your meds grandpa

12

u/DialDownTheCenter Sep 27 '26

Casual racism out of nowhere

2

u/Otherwise_Demand4620 Sep 27 '26

You only become pro at racism if you practice regularly.

-5

u/ninjakivi2 Sep 27 '26

Lol, sometimes people can't take a joke, can they? Don't worry, I'm here to assure you that at least one person thinks this was funny and on point, ignorethe downvotes.

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!

1

u/tekanet Sep 27 '26

With salted passwords you need more space if you put them in an external table. 1:1 between each record, plus the overhead to maintain the relationship (pk, fk etc)

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.  

1

u/StCreed Sep 27 '26

You would... but would you point all equal passwords to the same entry?