# The Purpose of Salt

> Why do we add a salt to passwords before hashing them, and how should the salt be generated and stored?

Canonical: https://www.internhack.in/learn/interview/web-security/security-salting-passwords
Last updated: 2026-11-28

Difficulty: Intermediate

## Question

Why do we add a salt to passwords before hashing them, and how should the salt be generated and stored?

*The full answer is for InternHack members. Open the page link above to read it.*

## Concepts covered

Password Salt, Rainbow Tables, Password Hashing, Precomputation Attacks

Previous: [Homograph Attack](https://www.internhack.in/learn/interview/web-security/security-homograph-attack) · Next: [Pepper vs. Salt](https://www.internhack.in/learn/interview/web-security/security-peppering-passwords) · [All of Web Security (OWASP, JWT, XSS, CSRF)](https://www.internhack.in/learn/interview/web-security)

## More Web Security (OWASP, JWT, XSS, CSRF) questions

- [Insecure Deserialization](https://www.internhack.in/learn/interview/web-security/security-insecure-deserialization)
- [JSON Poisoning](https://www.internhack.in/learn/interview/web-security/security-json-poisoning)
- [Directory Traversal](https://www.internhack.in/learn/interview/web-security/security-directory-traversal)
- [Principle of Least Privilege](https://www.internhack.in/learn/interview/web-security/security-least-privilege)
- [Zero Trust](https://www.internhack.in/learn/interview/web-security/security-zero-trust-architecture)
- [CSP: Content Security Policy](https://www.internhack.in/learn/interview/web-security/security-content-security-policy)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Web Security (OWASP, JWT, XSS, CSRF)](https://www.internhack.in/learn/interview/web-security)
