TL;DR
Using deliberately low-entropy hashes can make dictionary attacks slower, but it’s not a secure solution. It trades one vulnerability (fast cracking of simple hashes) for another (increased collision risk and potential denial-of-service). Strong hashing algorithms with salting are always the best approach.
Understanding the Problem
Dictionary attacks work by pre-calculating hashes for common passwords. If your system uses a weak hash, an attacker can quickly compare these pre-calculated hashes to those stored on your server. Low-entropy hashes have fewer possible values, making them easier to crack with brute force or dictionary methods.
Can Low Entropy Help?
Yes, but it’s a risky trade-off. Reducing the entropy of a hash function makes it faster to compute and faster to crack – unless you also introduce other factors that slow down attackers more than legitimate users. The idea is to make the hashes so similar that an attacker’s precomputed dictionary becomes less effective due to collisions.
How to Implement (with warnings!)
- Choose a Weak Hash Function: Start with a simple hash algorithm like MD5 or SHA-1. Warning: These are considered insecure for general password storage!
- Truncate the Hash: Reduce the length of the hash output. For example, instead of a full 32-character MD5 hash, use only the first 8 characters. This drastically lowers entropy.
python import hashlib password = "mysecretpassword" m = hashlib.md5(password.encode()) hash_truncated = m.hexdigest()[:8] print(hash_truncated) # Example: 'e10adc39' - Add a Short, Static Salt (Optional): A short salt can slightly increase complexity but doesn’t address the core entropy issue.
python salt = "abc" m = hashlib.md5((password + salt).encode()) hash_truncated = m.hexdigest()[:8] print(hash_truncated) - Collision Testing: Thoroughly test for collisions! With low entropy, many different passwords will produce the same hash. This is a major security risk.
Warning: High collision rates can lead to denial-of-service attacks if an attacker finds multiple passwords that hash to the same value.
Why It’s Not Recommended
- Increased Collision Risk: The biggest problem. Collisions allow attackers to potentially bypass authentication by using a different password with the same hash as a legitimate user.
- Still Vulnerable to Brute Force: While dictionary attacks are slowed, brute-force attacks become more feasible due to the reduced entropy.
- Rainbow Tables: Attackers can create smaller rainbow tables tailored to your low-entropy hashes.
- Doesn’t Address Salting Properly: A short static salt is easily bypassed. Proper salting requires unique, randomly generated salts for each password.
Secure Alternatives
- Use Strong Hashing Algorithms: Use bcrypt, Argon2, or scrypt. These algorithms are designed to be slow and computationally expensive, making brute-force attacks difficult.
- Implement Proper Salting: Generate a unique, random salt for each password and store it alongside the hash.
python import secrets salt = secrets.token_hex(16) # 16 bytes = 32 hex characters m = hashlib.sha256((password + salt).encode()) hash_with_salt = m.hexdigest() print(f"Salt: {salt}") print(f"Hash with Salt: {hash_with_salt}") - Key Stretching: Use key stretching techniques (built into bcrypt, Argon2, and scrypt) to further increase the computational cost of cracking.
Conclusion
Deliberately using low-entropy hashes is a flawed security strategy. It introduces significant risks that outweigh any potential benefits. Focus on implementing strong hashing algorithms with proper salting and key stretching for robust cyber security.

