A modern, compositional password pattern engine and hashcat orchestrator
Project description
HashSmith
⚠️ Beta Software: This project is under active development.
A modern, compositional password pattern engine and hashcat orchestrator for Python.
Philosophy: Declarative, composable, explicit patterns for targeted password generation.
For detailed documentation, see the wiki: github.com/BaksiLi/hashsmith/wiki
- Operational Semantics: Mathematical foundations and pattern engine semantics.
- Transforms: How to use
.alter()and.expand()effectively. - Examples: Practical patterns and scenarios.
✨ Core Features
- 🧱 Compositional: Build complex patterns from simple, reusable pieces.
- 📝 Declarative: Describe what you want, not how to generate it.
- 📖 Readable: Code structure documents the password pattern.
- 🔧 Extensible: Easy to add new pattern types and transforms.
- 🧠 Memory Efficient: Lazy generation for combining patterns to handle massive keyspaces.
🚀 Quick Start
from hashsmith.patterns import P, Birthday, Transform
# Build a [word][numbers][suffix] pattern
pattern = (
P(["crypto", "bitcoin"]).expand(Transform.CAPITALIZE) &
(
P(["123", "456", "789"]) |
Birthday(years=[1990, 1995], formats=["MMDD"])
) &
P(["", "!", "$"])
)
# Generate and print the first 10 passwords
passwords = list(pattern.generate(min_len=6, max_len=15))
for p in passwords[:10]:
print(p)
# → crypto123, crypto123!, crypto123$, crypto456, ...
🧩 Core Components
| Component | Purpose | Example |
|---|---|---|
P |
Basic pattern with items | P(["word1", "word2"]) |
& (PAnd) |
Sequential concatenation | pattern1 & pattern2 |
| (POr) |
Alternatives (choose one) | pattern1 | pattern2 |
| Transforms | Inclusive .expand() or exclusive .alter() |
P(["a"]).expand(Transform.UPPER) |
Additional Patterns
| Pattern | Purpose | Example |
|---|---|---|
Birthday |
Date-based patterns (calendar-aware) | Birthday(years=[1990], formats=["MMDD"]) |
Coming Soon: Incremental, Charset, Keyboard patterns
⚡ Transform System
HashSmith supports two transformation modes:
# Inclusive expansion (adds to the set)
P(["hello"]).expand(Transform.UPPER)
# → ["hello", "HELLO"]
# Exclusive alteration (replaces the set)
P(["hello"]).alter(Transform.UPPER)
# → ["HELLO"]
# Mix alter (exclusive) and expand (inclusive)
# Prefer `.alter()` before `.expand()` when chaining
P(["web"]).alter(Transform.UPPER).expand(Transform.REVERSE)
# → ["WEB", "BEW"]
# Chained expansions accumulate results
P(["hello"]).expand(Transform.UPPER).expand(lambda x: x + "!")
# → ["hello", "HELLO", "hello!", "HELLO!"]
# Available transforms
Transform.UPPER, Transform.LOWER, Transform.CAPITALIZE
Transform.LEET_BASIC # hello → h3ll0
Transform.REVERSE # hello → olleh
Transform.ZERO_PAD_2 # 5 → 05
Transform.REPEAT
🔥 Attack on Hashes
HashSmith generates wordlists optimized for Hashcat attacks:
from hashsmith.attacks import DictionaryAttack
from hashsmith.core import HashcatRunner
# Generate targeted wordlist
pattern = pattern # build your pattern
# save_to_file(pattern, "custom.txt", min_len=8, max_len=16)
# Run hashcat attack
attack = DictionaryAttack("/usr/bin/hashcat")
runner = HashcatRunner("/usr/bin/hashcat")
command = attack.generate_command(
hash_file="hashes.txt",
wordlist="custom.txt",
)
runner.run(command)
COMING: Piping with Hashcat.
📦 Installation
# Clone repository
git clone https://github.com/yourusername/hashsmith.git
cd hashsmith
# Install with PDM
pdm install
# Or install dependencies manually
pip install -r requirements.txt
📖 Development
For development, testing, and contribution guidelines, see CONTRIBUTING.md.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hashsmith-0.2.1.tar.gz.
File metadata
- Download URL: hashsmith-0.2.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.25.9 CPython/3.11.12 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7df22e4c83c801f88dc90f806bf3df52d714cffccc10f178bc869a6302869c78
|
|
| MD5 |
0c57595d09f18726bb082b745cc86340
|
|
| BLAKE2b-256 |
62c0eb9b0062106327adbafd71c311056d4456d08ddb884be8ae4739f339c0ce
|
File details
Details for the file hashsmith-0.2.1-py3-none-any.whl.
File metadata
- Download URL: hashsmith-0.2.1-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.25.9 CPython/3.11.12 Darwin/24.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94b84a56b5c9f6352b5253a92d4e23a3d63105d6fbc79cb6db745a1b99e6a072
|
|
| MD5 |
3d9d0aa162fdbc9606e2f2fdde835d80
|
|
| BLAKE2b-256 |
254d0c07781a0bfe3f51301396134ef2c4a5cecfba64ad8f10e1cd51b05c7503
|