Lab Guide — GPU Acceleration & Performance
Six hands-on exercises testing GPU detection, attack modes, workload tuning, thermals, and CPU vs GPU comparison.
rockyou.txt wordlist available.
hashes.txt with known MD5 hashes for testing. For example:
# Generate test hashes
echo -n "password" | md5sum | cut -d' ' -f1 > hashes.txt
echo -n "123456" | md5sum | cut -d' ' -f1 >> hashes.txt
echo -n "qwerty" | md5sum | cut -d' ' -f1 >> hashes.txt
echo -n "letmein" | md5sum | cut -d' ' -f1 >> hashes.txt
echo -n "welcome" | md5sum | cut -d' ' -f1 >> hashes.txt
Exercise 1 — Check GPU Availability
Detect compute devices with Hashcat and system tools
Verify that your GPU is properly detected before running any attacks.
- Run
hashcat -Iand note all detected devices, their IDs, types, and memory - For NVIDIA: run
nvidia-smiand record the GPU name, driver version, CUDA version, and current temperature - For AMD or general OpenCL: run
clinfoand note the platform and device details - Run
hashcat -b -m 0to benchmark MD5 on your system and record the speed
# Step 1: Hashcat device info
hashcat -I
# Step 2: NVIDIA system info
nvidia-smi
# Step 3: OpenCL info (all vendors)
clinfo
# Step 4: Quick MD5 benchmark
hashcat -b -m 0
Checkpoint: You can identify your GPU by name and device ID. The benchmark completes without errors.
Exercise 2 — GPU Dictionary Attack
Run a dictionary attack using the GPU
Crack the test hashes using rockyou.txt on the GPU.
- Run the attack with GPU device type:
# Dictionary attack on GPU
hashcat -m 0 -a 0 -D 2 -o cracked_gpu.txt hashes.txt rockyou.txt
- Observe the output: note the speed (H/s), progress, and time to completion
- Check the results file:
# View cracked passwords
cat cracked_gpu.txt
Checkpoint: All test hashes are cracked. The speed shows millions or billions of H/s (depending on your GPU).
Exercise 3 — GPU Mask Attack
Run a brute-force mask attack on the GPU
Use a mask to brute-force short passwords on the GPU.
- Create a hash of a short known password (e.g., "test1"):
# Create a test hash for mask attack
echo -n "test1" | md5sum | cut -d' ' -f1 > mask_test.txt
- Run a mask attack targeting 5-character lowercase+digit passwords:
# Mask attack: 4 lowercase letters + 1 digit
hashcat -m 0 -a 3 -D 2 -o cracked_mask.txt mask_test.txt ?l?l?l?l?d
- Note the speed, keyspace size, and estimated time to exhaustion
- Verify the result:
cat cracked_mask.txt
Checkpoint: The mask attack finds "test1". You can explain the keyspace size (26^4 * 10 = 4,569,760 candidates).
Exercise 4 — Workload Profile Comparison
Compare speeds across all four workload profiles
Test each workload profile and record the hash rate.
- Run the benchmark for each profile and record the speed:
# Test workload profile 1 (Low)
hashcat -b -m 0 -D 2 -w 1
# Test workload profile 2 (Medium)
hashcat -b -m 0 -D 2 -w 2
# Test workload profile 3 (High)
hashcat -b -m 0 -D 2 -w 3
# Test workload profile 4 (Maximum)
hashcat -b -m 0 -D 2 -w 4
- Record the results in a comparison table:
Profile | Speed (H/s) | System Responsiveness
--------|----------------|----------------------
-w 1 | ______________ | ______________________
-w 2 | ______________ | ______________________
-w 3 | ______________ | ______________________
-w 4 | ______________ | ______________________
- Note the speed increase percentage between profiles
Checkpoint: You have a completed comparison table. Speed increases with each profile level.
Exercise 5 — Temperature Limits
Set thermal safeguards and observe throttling behaviour
Configure temperature limits and monitor GPU thermals during an attack.
- Open a second terminal and start monitoring GPU temperature:
# NVIDIA: refresh every 1 second
nvidia-smi -l 1
# Linux alternative (AMD/NVIDIA)
watch -n1 sensors
- In the first terminal, run an attack with thermal limits:
# Attack with temperature controls
hashcat -m 0 -a 3 -D 2 -w 3 \
--gpu-temp-abort=85 \
--gpu-temp-retain=75 \
hashes.txt ?a?a?a?a?a?a
- Observe the Hashcat status output — look for temperature readings and any throttling messages
- Press
sduring the attack to see the current status including temperature - Press
qto quit when you have observed enough data
Checkpoint: Temperature stays at or below the retain value. You can see Hashcat adjusting speed to manage thermals.
Exercise 6 — CPU vs GPU Performance
Compare CPU and GPU cracking speeds
Run the same attack on CPU and GPU to quantify the performance difference.
- Benchmark MD5 on CPU only:
# CPU benchmark
hashcat -b -m 0 -D 1
- Benchmark MD5 on GPU only:
# GPU benchmark
hashcat -b -m 0 -D 2
- Run the same dictionary attack on both and compare wall-clock time:
# CPU dictionary attack (time it)
time hashcat -m 0 -a 0 -D 1 -o cracked_cpu.txt hashes.txt rockyou.txt
# GPU dictionary attack (time it)
time hashcat -m 0 -a 0 -D 2 -o cracked_gpu2.txt hashes.txt rockyou.txt
- Calculate the speedup factor: GPU speed / CPU speed
- Repeat the comparison for a slower hash type like SHA-256 (
-m 1400) or bcrypt (-m 3200)
# Benchmark SHA-256 on CPU vs GPU
hashcat -b -m 1400 -D 1
hashcat -b -m 1400 -D 2
Checkpoint: You can state the GPU speedup factor for at least two hash types. GPU is significantly faster for both.
--potfile-disable or remove the potfile between runs: rm -f ~/.local/share/hashcat/hashcat.potfile