Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It’s a 6 digit pin. Doesn’t seem worthwhile to hash. What are the best practices here? I’m not sure




There is never a need to store a pin in the database, store it in temporary storage like redis. Set the TTL to the expiration date. You can hash if needed, but I’m less concerned that someone hacks into your reds instance and steals your pins from the last 10 minutes, bc everything else is gone.

There should never be a need to return a pin to the client. You’ve already texted/emailed it to them. They are going to send it back to you. You will check against your temporary storage, verify/reject, and delete it immediately after.


Yeah, you can only delay attacks by a tiny little bit, but the search space of 10^6 is just too small. Salting it doesn't give you much more security.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: