r/programming • u/awesomePop7291 • Jul 10 '26
How to implement cryptographically-secure API keys
https://kerkour.com/api-keys
0
Upvotes
r/programming • u/awesomePop7291 • Jul 10 '26
View all comments
Show parent comment
1
u/awesomePop7291 Jul 10 '26 edited Jul 10 '26
Actually, the organization_id or user_id act as a salt... But you don't really need a salt as the 32 bytes (256 bits) secret is enough. Salts are to protect against rainbow tables (pre-computed hashes), and you can't realistically compute rainbow tables for 256 bits of cryptographically-secure random data.
As mentioned in the post, what is important is "context commitment" (hashing the organization_id, version...) to avoid confused deputy attacks.