Hashcat Rule Minimizer
minimize_rules
Eliminate functionally redundant Hashcat rules using signature-based deduplication. Built-in probe set — no wordlist required.
Pure Python
CPU-only · No GPU
Signature-based dedup
tqdm progress
Preserves file order
What does it do?
Two rules are functionally equivalent if they produce identical output on every possible input word. This tool checks a carefully chosen probe set covering short/long words, mixed-case, digits, specials, and repeated chars.
Rules producing the same transformed strings for all probes are indistinguishable in a real attack. Only the first occurrence (by file order) is kept. This reduces disk size, loading time, and Hashcat's internal overhead without losing any coverage.
Example: rule c (capitalize) and chain l c on already-lowercase inputs produce identical output → same signature → only c survives.
Key Features
⌗
Built-in 30-word probe set
Covers short (len 2–4), typical bases (7–9), long (10+), mixed-case, digits, specials, and repeated chars. Works out of the box.
∑
Signature-based dedup
Computes output tuple per rule. Identical signatures = functionally equivalent. First-in-file order survives.
+
Extensible probe sources
Add words via --extra-probes or sample from a wordlist with --probe-file. All sources merged and deduplicated.
≡
Progress & statistics
tqdm progress bar plus counters: rules loaded, kept, removed, and % reduction.
Built-in Probe Set (30 words)
These words are always used — no wordlist needed. They exercise every important Hashcat rule category.
ababcabcd
passroottestadminlogin
letmeinwelcomepasswordsunshine
footballbaseballprincessdragon12
qwertyuiopiloveyou12monkey12345superman123mustang2024
PasswordAdminUserMySecretHelloWorld
pass123admin2024test1234user9999
p@ssw0rds3cur1tyaaaabbbb
Use --list-probes to see the full list with lengths.
Installation & Usage
# Download the script
wget https://gist.githubusercontent.com/A113L/f4cacfeaf04d4412387d77ed12a084dd/raw/minimize_rules.py
# Install optional dependency
pip install tqdm
# Basic minimization (built-in probe set only)
python minimize_rules.py my_rules.rule -o minimized.rule
# Add your own probe words
python minimize_rules.py my_rules.rule --extra-probes password admin 123456
# Sample extra probes from a wordlist
python minimize_rules.py my_rules.rule --probe-file rockyou.txt --probe-words 100
# Combine all sources
python minimize_rules.py rules.txt \
--extra-probes "letmein" "welcome" \
--probe-file /usr/share/wordlists/fasttrack.txt \
--probe-words 50 \
-o final.rule
How the Signature is Computed
Step 1
Probe set assembly
Built-in words + --extra-probes + sampled words from --probe-file (deduplicated).
Step 2
Rule application
A pure-Python interpreter applies every rule atom (all GPU-compatible Hashcat opcodes) to each probe word. Unsupported opcodes fall into a (__UNSUPPORTED__,) bucket.
Step 3
Signature tuple
For each rule, collect transformed outputs for all probes into a tuple: ("Abc", "Def", ...).
Step 4
Deduplication
A dictionary maps signature → first rule seen. Rules with identical signatures are discarded.
Get the Script
The complete minimize_rules.py is hosted on GitHub Gist.
View minimize_rules.py on GitHub Gist
After downloading: chmod +x minimize_rules.py (Linux/macOS) or run with python minimize_rules.py