3 ms·
To make it even more obvious, it's to prevent this (I haven't done SQL in a long while so this may be broken): SELECT username FROM users WHERE password=HASH
by nitrogen 16y ago
To make it even more obvious, it's to prevent this (I haven't done SQL in a long while so this may be broken):
SELECT username FROM users WHERE password=HASH('secret');
I've seen systems where that statement will give a list of all usernames with the password "secret".
- rmc 16y agoIf you use a salt you could still do this 'attack. SELECT username FROM users WHERE password = HASH(salt||'secret'); This is academic because you already know the password ('secret'). Salts make rainbow tables (essentially precomputed hash values of (say) all english words) hard and infesiable.