How to get a Salted Password:
1. Place chicken password in slow cooker. Season with salt and pepper.
2. Cook on high, stirring occasionally, for 4 hours...
Process in system design
- Features(2 mins). Specify features of this system.
- Estimation(5 mins). Number of user, traffic(read and write), QPS and outlier behavior.
- Design goals(2 mins). Latency, consistency and availability.
- Skeleton of design(5 mins). API and work flow of read and write request.
- Deep dive(20-30 mins). How to deal with fault tolerance, read and write efficiently in database layer, load balancer, sharding,
- Factors to be considered: availability, performance(latency), reliability, scalability, manageability and cost.
Salted Password Hash
- The account database is usually attacked, so password is not stored in the database. Rather, some indirect information, like the salted password hash is stored.
- Upon receiving a password, its hashcode is checked against the database. To improve its security, a salt, which is a random string, is added when hashed. So in database we will store the salt and final hashcode.
- To crack such system, we can use lookup table or rainbow table(where more hashes are stored in same table).
Other notes
- RDBMS works better for joining relations, while NoSQL has more flexible scheme and efficient column analysis.
- HBase do consistent hashing inherently, and writes are cheaper.
- Concerns with distributed data/functionality: data locality and consistency
References
- CS75 Lec9 - Scalability by David Malan
- Salted Password Hashing - Doing it Right
- System design on InterviewBit
- Scalable Web Architecture and Distributed Systems by Kate Matsudaira