Password Strength & Entropy Checker
Evaluate password security with Shannon entropy (bits), brute-force crack time estimation, and NIST compliance checks.
Unlike conventional calculator sites that send your financial numbers, payload data, or code snippets across remote web servers, Affi-Chain processes all mathematical derivations, algorithms, and data parsing 100% locally within your browser sandbox. No tracking cookies, no server-side retention, and zero transmission lag.
Information Theory & Modern Password Entropy
A Password Strength Checker quantifies the computational resistance of a password against dictionary attacks, pattern matching, credential stuffing, and high-speed offline brute-force cracking. In formal computer science, password strength is not determined by cosmetic complexity rules (such as forcing an arbitrary exclamation point or capital letter); it is governed by Shannon Information Entropy:
$$H = L \times \log_2(R)$$
Where:
- $H$ represents the password's entropy measured in bits.
- $L$ represents the total character length.
- $R$ represents the cardinality of the candidate symbol pool (the character set space).
+---------------------------------------------------------------------------------------------------+
| PASSWORD ENTROPY SPECTRUM |
+---------------------------------------------------------------------------------------------------+
| < 40 BITS: CRITICAL VULNERABILITY 80 - 100 BITS: ENTERPRISE GRADE |
| - Cracking Time: < 1 Second (Consumer GPU) - Cracking Time: Centuries |
| - Examples: "password123", "Admin2024!" - Examples: 16-char alphanumeric / words|
+---------------------------------------------------------------------------------------------------+
|
v
+---------------------------------------------------------------------------------------------------+
| 40 - 64 BITS: WEAK TO MODERATE > 128 BITS: CRYPTOGRAPHIC IMMUNITY |
| - Cracking Time: Minutes to Days - Cracking Time: Exceeds Universe Age |
| - Examples: 8-char mixed case ("P@ssw0rd") - Examples: 24-char full ASCII password |
+---------------------------------------------------------------------------------------------------+
The Fallacy of Visual Complexity: Why P@ssw0rd! Fails
Traditional legacy password meters evaluate complexity based on simple character diversity rules: rewarding the presence of uppercase letters, digits, and special characters. This approach is fundamentally flawed:
- Human Predictability: Human users follow predictable cognitive patterns: capitalizing the first letter, replacing
owith0orawith@(leetspeak), and placing!or1at the very end. - Effective Entropy Collapse: A password like
P@ssw0rd1!appears "strong" to naive meters because it satisfies all four character classes. However, password cracking engines (such as Hashcat and John the Ripper) apply targeted rule-based mutations that test these patterns in fractions of a millisecond. - Modern Pattern Matching (zxcvbn): Next-generation entropy models evaluate passwords by identifying spatial keyboard walks (
qwerty,123456), dictionary words, common personal names, dates (2026), and repeated substrings, estimating true Guess Entropy rather than theoretical Shannon entropy.
Mathematical Formulations & Search Space Matrix
The total computational search space $S$ represents the total number of permutations an attacker must evaluate in an exhaustive brute-force search:
$$S = R^L$$
+---------------------------------------------------------------------------------------------------+
| CHARACTER POOL CARDINALITY (R) |
+---------------------------------------------------------------------------------------------------+
| Character Class Set Symbols Included Cardinality (R) |
| -------------------------------------- -------------------------------- --------------------- |
| Numeric Digits 0 - 9 10 |
| Lowercase Latin Letters a - z 26 |
| Uppercase Latin Letters A - Z 26 |
| Alphanumeric Mixed a-z, A-Z, 0-9 62 |
| Standard ASCII Printable Symbols !@#$%^&*()-_=+[]{}|;:,.<>? 32 |
| Complete Printable ASCII Space All alphanumeric + symbols 94 |
+---------------------------------------------------------------------------------------------------+
Time-to-Crack Formulation ($T$)
The theoretical time required to crack a password offline at a given testing velocity $V$ (hashes evaluated per second):
$$T_{\text{seconds}} = \frac{R^L}{2 \times V}$$
Dividing by $2$ reflects the statistical expectation that an attacker will encounter the correct secret halfway through the total search space.
Production Code Implementation
Python: Advanced Pattern-Matching Password Strength Engine
#!/usr/bin/env python3
"""
Production Password Strength Analyzer.
Evaluates Shannon Entropy, checks for dictionary words and spatial keyboard walks,
and calculates offline crack times against modern GPU clusters.
"""
import math
import re
from typing import Dict, List, Tuple
class PasswordStrengthAnalyzer:
# Common dictionary patterns and keyboard walks
KEYBOARD_WALKS = [
"qwertyuiop", "asdfghjkl", "zxcvbnm",
"1234567890", "qazwsxedc", "password", "admin"
]
COMMON_SUBSTITUTIONS = {
"@": "a", "4": "a", "8": "b", "3": "e", "1": "i",
"!": "i", "0": "o", "$": "s", "5": "s", "7": "t",
}
GPU_HASH_RATE_FAST = 50_000_000_000 # 50 GH/s (e.g. NTLM / MD5 on 8x RTX 4090)
GPU_HASH_RATE_SLOW = 25_000 # 25 kH/s (e.g. Bcrypt cost 12 / Argon2id)
@classmethod
def evaluate(cls, password: str) -> Dict[str, object]:
length = len(password)
if length == 0:
return {"score": 0, "status": "Empty", "entropy_bits": 0.0}
pool_size = 0
has_lower = bool(re.search(r"[a-z]", password))
has_upper = bool(re.search(r"[A-Z]", password))
has_digit = bool(re.search(r"[0-9]", password))
has_symbol = bool(re.search(r"[^a-zA-Z0-9]", password))
if has_lower: pool_size += 26
if has_upper: pool_size += 26
if has_digit: pool_size += 10
if has_symbol: pool_size += 32
# Raw Shannon Entropy
raw_entropy = length * math.log2(pool_size) if pool_size > 0 else 0.0
# Pattern penalties
penalties = 0.0
normalized = password.lower()
for char, sub in cls.COMMON_SUBSTITUTIONS.items():
normalized = normalized.replace(char, sub)
# Detect keyboard walks or common words
for walk in cls.KEYBOARD_WALKS:
if walk in normalized:
penalties += 15.0
# Detect repeated characters e.g. 'aaaa' or '1111'
if re.search(r"(.)\1{2,}", password):
penalties += 10.0
effective_entropy = max(0.0, raw_entropy - penalties)
# Classify strength tier
if effective_entropy < 35:
score = 1
verdict = "Very Weak (Vulnerable to instant offline crack)"
elif effective_entropy < 55:
score = 2
verdict = "Weak (Crackable within hours/days)"
elif effective_entropy < 75:
score = 3
verdict = "Moderate (Acceptable for non-sensitive logins)"
elif effective_entropy < 95:
score = 4
verdict = "Strong (Enterprise Grade)"
else:
score = 5
verdict = "Very Strong (Cryptographically Resilient)"
# Calculate time to crack
permutations = 2 ** effective_entropy
crack_sec_fast = (permutations / 2) / cls.GPU_HASH_RATE_FAST
crack_sec_slow = (permutations / 2) / cls.GPU_HASH_RATE_SLOW
return {
"password_length": length,
"pool_size": pool_size,
"raw_entropy_bits": round(raw_entropy, 1),
"effective_entropy_bits": round(effective_entropy, 1),
"score_out_of_5": score,
"verdict": verdict,
"time_to_crack_fast_hash": cls._format_duration(crack_sec_fast),
"time_to_crack_slow_hash": cls._format_duration(crack_sec_slow),
}
@staticmethod
def _format_duration(seconds: float) -> str:
if seconds < 1:
return "Instant (< 1 second)"
elif seconds < 60:
return f"{round(seconds)} seconds"
elif seconds < 3600:
return f"{round(seconds / 60)} minutes"
elif seconds < 86400:
return f"{round(seconds / 3600)} hours"
elif seconds < 31536000:
return f"{round(seconds / 86400)} days"
elif seconds < 31536000 * 1000:
return f"{round(seconds / 31536000)} years"
else:
return "Centuries (Permanently Infeasible)"
# Demonstration
if __name__ == "__main__":
test_passwords = [
"P@ssw0rd1!",
"correct-horse-battery-staple",
"kX9#m$L2!vQ8@zP1",
]
for p in test_passwords:
res = PasswordStrengthAnalyzer.evaluate(p)
print(f"\nPassword: '{p}'")
print(f" - Length: {res['password_length']}")
print(f" - Effective Entropy: {res['effective_entropy_bits']} bits")
print(f" - Strength Rating: {res['score_out_of_5']}/5 ({res['verdict']})")
print(f" - Crack Time (MD5): {res['time_to_crack_fast_hash']}")
print(f" - Crack Time (Bcrypt): {res['time_to_crack_slow_hash']}")
TypeScript: Client-Side Registration Form Password Validator
export interface PasswordAudit {
score: 0 | 1 | 2 | 3 | 4;
entropy: number;
suggestions: string[];
isPwnedVulnerable: boolean;
}
export function auditPassword(password: string): PasswordAudit {
const suggestions: string[] = [];
let pool = 0;
if (/[a-z]/.test(password)) pool += 26;
if (/[A-Z]/.test(password)) pool += 26;
if (/[0-9]/.test(password)) pool += 10;
if (/[^a-zA-Z0-9]/.test(password)) pool += 32;
let entropy = password.length * Math.log2(pool || 1);
if (password.length < 12) {
suggestions.push("Increase length to at least 12-16 characters.");
}
if (/^[a-zA-Z]+$/.test(password)) {
suggestions.push("Add numbers or punctuation to increase symbol pool.");
}
if (/12345|qwerty|password/i.test(password)) {
entropy = Math.max(0, entropy - 20);
suggestions.push("Avoid common dictionary words and keyboard sequences.");
}
let score: 0 | 1 | 2 | 3 | 4 = 0;
if (entropy > 80) score = 4;
else if (entropy > 60) score = 3;
else if (entropy > 40) score = 2;
else if (entropy > 20) score = 1;
return {
score,
entropy: Math.round(entropy),
suggestions,
isPwnedVulnerable: score < 2,
};
}
Authentication Security Standards Comparison Matrix
| Standard / Body | Minimum Character Length | Complexity Rule Mandate | Expiration / Rotation Policy | Breach Screening Requirement |
|---|---|---|---|---|
| NIST SP 800-63B | 8 characters (15 for admins) | No (Discouraged) | Prohibited unless compromised | Mandatory (Check leaked databases) |
| PCI-DSS v4.0 | 12 characters (15 for multi-tenant) | Yes (Alpha + Numeric) | Every 90 days (Unless MFA active) | Mandatory validation |
| OWASP ASVS v4.0 | 12 characters | No | Prohibited without incident | Mandatory (HaveIBeenPwned API) |
| CIS Benchmarks | 14 characters | Yes | Optional | Highly Recommended |
Common Traps & Antipatterns in Password Policies
1. Mandatory Periodic Expiration Policies (90-Day Rotations)
For decades, IT administrators forced users to change passwords every 60 or 90 days. NIST and OWASP have explicitly reversed this policy:
- When forced to create new passwords frequently, users predictably increment a trailing number (
Spring2025!$\to$Spring2026!). - Attackers who compromise a previous hash easily guess subsequent mutations. Passwords should be changed only upon confirmed compromise or credential leak.
2. Arbitrary Maximum Length Limits
Some legacy web applications restrict passwords to 16 or 20 characters, or reject special symbols.
- Arbitrary maximums prevent users from adopting secure 4-to-6 word Diceware Passphrases (
correct horse battery staple), which naturally exceed 25 characters. - Secure authentication engines should permit passphrases up to at least 64 or 128 characters and accept all printable UTF-8 characters.
3. Failing to Screen Against Breached Password Databases
A password can possess 80 bits of mathematical entropy, but if it appeared in a previous public data breach (such as RockYou2024), attackers test it within the first few seconds of a dictionary attack. Modern authentication architectures must integrate automated breach screening via the Have I Been Pwned Pwned Passwords API using k-Anonymity SHA-1 hash prefix lookups.