🔓
What is a salt?
A salt is a random string added to your password before hashing. It makes hashes stronger and prevents attackers from using precomputed lists.
Hash length: —
🔒
Hash time: — ms
How to Use This Hash in Your Website
You can store this hash instead of the real password. When a user logs in, hash their input the same way and compare it to the stored hash.
// Example (JavaScript)
const storedSalt = "SOME_SALT";
const storedHash = "PASTE_HASH_HERE";
async function hashPassword(password, salt) {
const encoder = new TextEncoder();
const data = encoder.encode(salt + password);
const hashBuffer = await crypto.subtle.digest("SHA-256", data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(b => b.toString(16).padStart(2, "0")).join("");
}
async function verifyPassword(inputPassword) {
const inputHash = await hashPassword(inputPassword, storedSalt);
return inputHash === storedHash;
}
This is how websites safely check passwords without ever storing the real one.
Security Notes
- Never store plain passwords — always store hashes.
- Use a unique salt per user to make attacks harder.
- Hashing is not encryption; hashes cannot be “decrypted” back to the original password.
- For production systems, consider dedicated password hashing algorithms like PBKDF2, bcrypt, or Argon2.