Create a master password with at least 80 bits of entropy: use a random 6-8 word passphrase (e.g., generated via diceware) or a 16+ character random string mixing uppercase, lowercase, digits, and symbols. Pair it with a password manager that uses Argon2id for key derivation, never reuse it anywhere, and store a paper backup in a secure location. This guide covers entropy calculations, key derivation function comparisons, common vulnerabilities, and practical steps for both users and developers implementing password strength requirements.
Understanding Master Password Entropy
Entropy measures the randomness of your password in bits. Higher entropy means more possible combinations an attacker must enumerate. For master passwords, target at least 80 bits of entropy—this provides sufficient security against offline attacks even if your password database is compromised.
For a truly random master password using uppercase, lowercase, digits, and symbols:
Entropy = log2(charset_size^password_length)
With a 95-character charset (standard keyboard):
- 12 characters: 78 bits
- 14 characters: 91 bits
- 16 characters: 105 bits
- 20 characters: 131 bits
def calculate_entropy(password: str) -> float:
"""Calculate password entropy in bits."""
charset_sizes = {
'lower': 26,
'upper': 26,
'digits': 10,
'symbols': 33
}
has_lower = any(c.islower() for c in password)
has_upper = any(c.isupper() for c in password)
has_digits = any(c.isdigit() for c in password)
has_symbols = any(not c.isalnum() for c in password)
size = sum(charset_sizes[k] for k, v in {
'lower': has_lower, 'upper': has_upper,
'digits': has_digits, 'symbols': has_symbols
}.items() if v)
return len(password) * (size.bit_length() - 1)
# Example
password = "Tr0ub4dor&3HorseBattery"
print(f"Entropy: {calculate_entropy(password):.1f} bits")
Passphrases: The Practical Approach
Random words from a dictionary (EFF wordlists are popular) provide better usability than character jumbles while maintaining security. A 6-word passphrase typically achieves 70-80 bits of entropy—suitable when paired with a strong key derivation function.
# Using diceware-style generation with /dev/urandom
# Generate a 6-word passphrase
python3 -c "
import secrets
words = open('/usr/share/dict/words').read().splitlines()
print(' '.join(secrets.choice(words) for _ in range(6)))
"
However, avoid famous quotes, song lyrics, or common phrases—attackers include these in dictionary attacks.
Key Derivation Functions: Why They Matter
Password managers don’t store your master password directly. Instead, they derive an encryption key using a key derivation function (KDF). This process is intentionally slow to hinder brute-force attacks.
Common KDFs and their parameters:
- Argon2id: Memory-hard function, resistant to GPU attacks. Configure with at least 64MB memory, 3 iterations, and 4 parallelism.
- PBKDF2: Widely supported but less resistant to modern GPU rigs. Use 600,000+ iterations with SHA-512.
- bcrypt: Legacy support, but Argon2 is preferred for new implementations.
import hashlib
import secrets
def derive_key_argon2(password: str, salt: bytes, memory_kb: int = 65536,
iterations: int = 3, parallelism: int = 4) -> bytes:
"""Derive encryption key using Argon2id."""
try:
import argon2
return argon2.hash_password(
password.encode(),
salt=salt,
time_cost=iterations,
memory_cost=memory_kb,
parallelism=parallelism,
type=argon2.Type.ID
)
except ImportError:
# Fallback to PBKDF2 if argon2 unavailable
return derive_key_pbkdf2(password, salt, iterations=600000)
def derive_key_pbkdf2(password: str, salt: bytes, iterations: int = 600000) -> bytes:
"""Derive encryption key using PBKDF2-HMAC-SHA512."""
return hashlib.pbkdf2_hmac(
'sha512',
password.encode(),
salt,
iterations,
dklen=32
)
# Example usage
salt = secrets.token_bytes(16)
key = derive_key_argon2("your-master-password", salt)
print(f"Derived key: {key.hex()[:32]}...")
What Makes a Master Password Vulnerable
Even with high entropy, certain patterns weaken master passwords:
- Personal information: Birthdates, pet names, anniversaries—easily guessed from social media
- Keyboard patterns: qwerty, asdfgh, 123456—present in every attack dictionary
- Reuse: Using the master password elsewhere means a breach of any service compromises it
- Short lengths: Below 12 characters, even random passwords become vulnerable to modern GPU clusters
Test your master password against real attack scenarios:
import hashlib
def estimate_crack_time(password: str, hash_rate: float = 100e9) -> str:
"""Estimate crack time at given hash rate (guesses per second).
Modern GPU rig: ~100 billion guesses/second for fast hashes
Password manager (Argon2): ~1000 guesses/second
"""
charset = 0
if any(c.islower() for c in password): charset += 26
if any(c.isupper() for c in password): charset += 26
if any(c.isdigit() for c in password): charset += 10
if any(not c.isalnum() for c in password): charset += 33
combinations = charset ** len(password)
seconds = combinations / hash_rate
if seconds < 60:
return f"{seconds:.0f} seconds"
elif seconds < 3600:
return f"{seconds/60:.0f} minutes"
elif seconds < 86400:
return f"{seconds/3600:.0f} hours"
elif seconds < 31536000:
return f"{seconds/86400:.0f} days"
else:
return f"{seconds/31536000:.0f} years"
# Test with password manager's slower hash rate
print(estimate_crack_time("Tr0ub4dor&3", 1000)) # With Argon2
print(estimate_crack_time("Tr0ub4dor&3", 100e9)) # With fast hash
Practical Recommendations
For developers implementing password manager features:
- Default to Argon2id for new implementations—it’s the winner of the Password Hashing Competition
- Enforce minimum lengths of 12 characters, recommend 16+
- Provide entropy meters but don’t trust them blindly—they can’t detect compromised passwords
- Implement account recovery options carefully—recovery mechanisms often become attack vectors
For users managing their vault:
- Generate a 6-8 word passphrase or 16+ character random string
- Never reuse your master password anywhere
- Store a paper backup in a secure location (safe deposit box)
- Enable two-factor authentication on your password manager account
- Test your master password strength using the calculation methods above
Conclusion
Master password strength combines entropy, key derivation function configuration, and avoiding predictable patterns. For developers, implementing Argon2id with proper parameters provides robust protection against offline attacks. For users, a 6-8 word passphrase or 16+ character random password, combined with a slow KDF, keeps your vault secure for years to come.
The security of your password manager ultimately depends on this single password—invest the effort to make it strong.
Related Reading
Built by theluckystrike — More at zovo.one