TL;DR — The 4 hashcat commands you'll use most
hashcat -m 0 -a 0 hashes.txt rockyou.txt # Dictionary attack
hashcat -m 0 -a 0 hashes.txt rockyou.txt -r best64.rule # With rules (much better)
hashcat -m 0 -a 3 hashes.txt ?d?d?d?d?d?d?d?d # Brute-force 8 digits
hashcat -m 0 -a 6 hashes.txt rockyou.txt ?d?d?d?d # Hybrid: word + 4 digits
Each is explained below with full examples. The -m flag changes by hash type (see the hash modes section).
What is Hashcat?
Hashcat is the world's fastest password recovery tool. It uses GPU compute (CUDA on NVIDIA, OpenCL on AMD) to test billions of password candidates per second against captured password hashes. On an RTX 4090, it cracks MD5 at 164 billion hashes per second — meaning the entire 14-million-entry rockyou.txt wordlist completes in under a millisecond.
Hashcat supports over 300 hash types — MD5, SHA-1, SHA-256, NTLM (Windows), bcrypt, scrypt, WPA2 handshakes, Kerberos tickets, KeePass databases, encrypted PDF/ZIP/Office files, and modern algorithms like Argon2. It's pre-installed on Kali Linux and is one of the essential Kali Linux tools in any pentester's arsenal.
How Hashcat Works
Hashcat doesn't "reverse" hashes — that's mathematically impossible. Instead, it does the same thing the original hashing system does: takes a candidate password, hashes it, and compares the result to your target hash. If they match, you've found the password.
The speed comes from doing this billions of times per second in parallel on a GPU. The technique that finds passwords comes from choosing good candidates — that's where attack modes, rules, and masks come in.
Installing & Verifying Hashcat
Hashcat ships pre-installed on Kali Linux. Verify it's there and that your GPU is detected:
If apt update fails with a signing-key or repository error, see how to fix broken Kali updates. If the terminal itself is new to you, the beginner commands guide covers the basics every example below assumes.
Hashcat Basic Syntax
Every hashcat command follows this pattern:
The two most important flags:
-m= hash mode (what kind of hash you're cracking — MD5 is 0, NTLM is 1000, WPA2 is 22000, etc.)-a= attack mode (how to generate candidates — dictionary, brute-force, hybrid, etc.)
The 6 Attack Modes
Hashcat has six attack modes. You'll use modes 0, 3, and 6 most often:
| Mode | Name | What It Does |
|---|---|---|
-a 0 | Straight (Dictionary) | Try each word in a wordlist |
-a 1 | Combinator | Combine words from two wordlists (word1+word2) |
-a 3 | Brute-force / Mask | Try all combinations matching a pattern |
-a 6 | Hybrid Wordlist + Mask | Append a mask to each wordlist entry |
-a 7 | Hybrid Mask + Wordlist | Prepend a mask to each wordlist entry |
-a 9 | Association | Targeted attack using known info (username, etc.) |
Common Hash Modes (the -m flag)
Hashcat supports over 300 hash types. Here are the ones you'll actually encounter:
| Mode | Hash Type | Where You'll See It |
|---|---|---|
0 | MD5 | Old web apps, CTFs, legacy systems |
100 | SHA-1 | Older systems, Git, some legacy auth |
1400 | SHA-256 | Common modern hash |
1000 | NTLM | Windows password hashes (from SAM, mimikatz, etc.) |
1800 | sha512crypt | Modern Linux /etc/shadow |
500 | md5crypt | Older Linux /etc/shadow |
3200 | bcrypt | Modern web apps, password managers |
22000 | WPA2 (PMKID+EAPOL) | WiFi handshakes (modern unified mode) |
13100 | Kerberos 5 TGS-REP | Active Directory "Kerberoasting" attacks |
18200 | Kerberos 5 AS-REP | "AS-REP roasting" attacks |
13400 | KeePass 1/2 | KeePass password database files |
9400 | MS Office 2007 | Encrypted Office documents |
17200 | PKZIP | Encrypted ZIP files |
34000 | Argon2 | Modern algorithm; very slow to crack |
If you don't know what hash type you have, use a hash identifier tool:
Dictionary Attack (-a 0) — Start Here
The dictionary attack is the most common — and most successful — type. You give hashcat a list of candidate passwords and it tries each one. If the password is in the list, you crack it.
Cracking an MD5 hash with rockyou.txt
You'll see hashcat initialize, then crack the hash. Output looks like:
The cracked password is shown right after the hash, separated by a colon: password.
Cracking multiple hashes at once
Put one hash per line in a file. Hashcat will crack them all in parallel — at no speed penalty.
Rule-Based Attacks (The Real Power)
This is where hashcat shines. Rules tell hashcat to automatically mutate each wordlist entry — appending years, capitalizing, substituting characters, reversing. A single wordlist entry like password becomes Password, password1, p@ssword, PASSWORD123, drowssap, and hundreds more.
Best64.rule generates 64 variations of each word. Applied to rockyou.txt's 14 million entries, that's nearly 1 billion candidates — without storing them on disk.
best64.rule and dive.rule. The community-maintained OneRuleToRuleThemAll.rule (search GitHub) is even more comprehensive. Skip writing custom rules until you've exhausted these — they're rarely necessary for general cracking.
Mask Attack (-a 3) — Brute-Force With Patterns
When you know something about the password's structure — like "it's 8 digits" or "it starts with a capital letter" — a mask attack is far more efficient than pure brute-force. You build a pattern from character placeholders:
| Placeholder | Charset | Example |
|---|---|---|
?l | Lowercase letters | abc...xyz |
?u | Uppercase letters | ABC...XYZ |
?d | Digits | 0-9 |
?s | Special characters | !"#$%&'()... |
?a | All printable ASCII | ?l + ?u + ?d + ?s |
?h | Hex lowercase | 0-9, a-f |
?H | Hex uppercase | 0-9, A-F |
Custom charsets
For patterns that don't fit the built-in charsets, define your own with -1 through -4:
Hybrid Attacks (-a 6 and -a 7)
Hybrid attacks combine a wordlist with a mask. They're often the most effective real-world attack because people constantly append numbers or years to common words.
Real-World Examples
Let's go through the most common scenarios you'll actually hit.
Cracking NTLM hashes (Windows passwords)
NTLM hashes come from mimikatz, secretsdump, the Windows SAM database, or NTLM relay attacks. They're fast to crack — RTX 4090 hits ~288 GH/s.
Cracking Linux /etc/shadow
Modern Linux uses sha512crypt ($6$ prefix). It's intentionally slow to crack — by design.
Cracking WPA2 WiFi handshakes
Mode 22000 handles both 4-way handshakes and PMKID captures. Capturing one in the first place needs a wireless card that supports monitor mode — see my guide to the best WiFi adapters for Kali Linux. For the full capture-to-crack workflow, see my WPA2 cracking tutorial.
Cracking encrypted files (ZIP, Office, KeePass)
For these, you extract the password hash from the file first using a helper script from John the Ripper:
GPU Benchmarks & Performance Tuning
Run hashcat -b for a full benchmark of your hardware across all hash types. Here are typical 2026 speeds on common GPUs:
| GPU | MD5 (-m 0) | NTLM (-m 1000) | WPA2 (-m 22000) | bcrypt (-m 3200) |
|---|---|---|---|---|
| RTX 4090 | 164 GH/s | 288 GH/s | 2,600 kH/s | 185 kH/s |
| RTX 4080 | 112 GH/s | 198 GH/s | 1,800 kH/s | 128 kH/s |
| RTX 4060 Ti | 52 GH/s | 92 GH/s | 750 kH/s | 52 kH/s |
| RTX 3090 | 97 GH/s | 175 GH/s | 1,600 kH/s | 108 kH/s |
| RTX 3060 | 32 GH/s | 58 GH/s | 470 kH/s | 32 kH/s |
| Apple M3 Max | ~28 GH/s | ~52 GH/s | ~420 kH/s | ~30 kH/s |
| Intel i7-13700K (CPU only) | ~6 GH/s | ~10 GH/s | 14 kH/s | ~2 kH/s |
Numbers are approximate — actual speed varies with hashcat version, drivers, system load, and exact silicon. Use hashcat -b to test your own hardware.
Performance flags
Session Management
Cracking sessions often take hours or days. Hashcat lets you pause, resume, and run multiple sessions in parallel.
Attack Strategy: What To Try First
The order I work through attacks on a new set of hashes:
- Identify the hash type with
hashidif unclear - Pure dictionary with rockyou.txt (5 seconds on a fast GPU — try it first)
- Dictionary + best64.rule (catches the majority of weak passwords)
- Dictionary + dive.rule (more aggressive mutations)
- Targeted wordlist + rules (SecLists, leaked databases, company-specific terms)
- Hybrid attack with year/digit suffix (people love "password2024")
- Mask attack on known patterns (router defaults are often 8 digits)
- Pure brute-force (only for short passwords on fast hash types)
Hashcat vs John the Ripper
The two big password crackers are hashcat and John the Ripper. They're often compared, but they're complementary tools — pros use both.
| Feature | Hashcat | John the Ripper |
|---|---|---|
| GPU acceleration | Excellent (built for it) | Limited |
| Speed (with GPU) | 100-185x faster | Slower |
| Hash format auto-detection | No (you specify -m) | Yes (automatic) |
| File-extraction helpers | External tools | Built-in (zip2john, etc.) |
| Number of hash types | 300+ | 400+ |
| Best for | Big jobs, fast hashes | Format detection, encrypted files |
Real workflow: use John for hash identification and to extract hashes from encrypted files (its *2john scripts are unmatched). Then run the actual cracking on hashcat for GPU speed.
Common Issues & Troubleshooting
"No devices found / no usable devices"
Hashcat can't find your GPU. Causes: outdated drivers, missing CUDA toolkit (NVIDIA), or running in a VM without GPU passthrough. Check with hashcat -I. On Linux, install nvidia-cuda-toolkit if missing. In a VM, you'll likely need to run on the host instead.
"Hashfile 'xxx' on line N: Token length exception"
The hash format doesn't match the mode you specified. Either the wrong -m, extra whitespace in the hash file, or hashes mixed with non-hash content. Run hashid 'your-hash' to verify the type, and make sure the file has one clean hash per line.
"Cracking takes forever"
The expected speed depends on hash type and hardware. hashcat -b -m [mode] tells you what your hardware achieves on that hash. If actual speed is much slower than the benchmark, you're running CPU fallback (not GPU). Check hashcat -I. If actual speed matches benchmark and it's still slow, the candidate space is just too large — switch attack modes or get better wordlists.
"GPU temperature triggered abort"
Your GPU got too hot. Improve case cooling, reduce workload from -w 3 to -w 2, or raise the abort threshold (--hwmon-temp-abort=85 — but don't go above 85°C on consumer cards).
"Hashcat found 0/N digests"
Hashcat ran successfully but didn't crack anything. The password isn't in your wordlist (try more wordlists, add rules, try a mask attack), or the hash format is wrong (try a different -m).
Frequently Asked Questions
How do I know which -m mode to use?
Use hashid 'your-hash-here' to identify the hash type. Then look up the mode number in hashcat --help or the hashcat example hashes page. Common ones: MD5 = 0, SHA-1 = 100, NTLM = 1000, sha512crypt = 1800, bcrypt = 3200, WPA2 = 22000.
Can I run hashcat on Windows or macOS instead of Kali?
Yes. Hashcat runs natively on Windows, macOS (including Apple Silicon), and Linux. The Windows version often performs better than running it in a Kali VM because GPU passthrough is finicky. Apple Silicon's Metal API gives M1-M4 chips solid performance — around 25-35 GH/s on MD5 depending on chip tier. Download from hashcat.net.
Is hashcat illegal?
Hashcat itself is 100% legal — it's just a password recovery tool, and it has legitimate uses (forensics, recovering your own forgotten passwords, authorized pentesting). What's illegal is using it on hashes you obtained without authorization. The CFAA (US), Computer Misuse Act (UK), and equivalent laws make unauthorized password cracking a serious crime.
How long would it take to crack my password?
Depends entirely on (1) the hash type and (2) the password complexity. A weak 8-char password on a fast hash like NTLM cracks in minutes. The same password on bcrypt takes hours. A 15-character random password with mixed character types is effectively uncrackable on any current hardware — longer than the age of the universe. Strong passwords + slow hashes = safe.
What's the difference between -a 0 and -a 3?
-a 0 (dictionary) tests each entry in a wordlist file. Fast and effective when passwords are common. -a 3 (brute-force/mask) generates every combination matching a pattern. Thorough but exponentially slower as length increases. Use -a 0 first; only fall back to -a 3 for short or pattern-restricted targets.
Do I really need a GPU for hashcat?
Not strictly — hashcat falls back to CPU mode without one. But CPU is roughly 100x slower for fast hashes (MD5, NTLM, SHA-256) and only marginally slower for very slow hashes (bcrypt, Argon2, scrypt). For any serious cracking work, get a GPU. Even a used RTX 3060 will dramatically outperform CPU-only cracking.
What's the best wordlist to use with hashcat?
Start with rockyou.txt — it's pre-installed and cracks a surprising amount. For bigger jobs, install SecLists (sudo apt install seclists) or download CrackStation's 15GB wordlist. For targeted attacks, build custom lists with CeWL (website-derived) or CUPP (profile-based). See my full wordlists guide.
Why does hashcat sometimes ignore my rules?
Two common causes: (1) the rule file has syntax errors — hashcat silently skips malformed lines and reports the count, (2) you're stacking too many rule files and hitting the maximum rule capacity. Run with --debug-mode=1 to see which rules are being applied. Stick to one rule file at a time until you understand the tool.
