# Hardcoded Salt in Password Hashing

> Detects hardcoded or static salt values used in password hashing, allowing precomputed rainbow table attacks.

- Skill: `zakirkun/hardcoded-salt-in-password-hashing` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add zakirkun/hardcoded-salt-in-password-hashing`
- Raw SKILL.md: https://api.skillmd.com/api/skills/zakirkun/hardcoded-salt-in-password-hashing/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: zakirkun (https://skillmd.com/u/zakirkun)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/zakirkun/hardcoded-salt-in-password-hashing

---


# Hardcoded Salt

## Overview
A salt's purpose is to make each password hash unique, even when two users have identical passwords. A hardcoded static salt negates this purpose because:
- All users with the same password have the same hash
- Precomputed tables (rainbow tables) can be built for that specific salt
- A database breach exposes all passwords simultaneously

## Remediation
Generate a unique random salt for each user:
```python
import os
import hashlib
salt = os.urandom(32)  # Random 32-byte salt per user
hash = hashlib.pbkdf2_hmac('sha256', password.encode(), salt, 600000)
# Store both salt and hash per user
```

