Skip to main content

A modern, compositional password pattern engine and hashcat orchestrator

Project description

HashSmith

A modern, declarative and compositional password pattern engine and Hashcat orchestrator for Python.

Docs: github.com/BaksiLi/hashsmith/wiki Blog: HashSmith: Crafting Password Patterns for Modern Workflows

✨ 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

# From PyPI (recommended)
pip install hashsmith

# From source
git clone https://github.com/BaksiLi/hashsmith.git
cd hashsmith
pdm install  # or: pip install -r requirements.txt

📖 Development

For development, testing, and contribution guidelines, see CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hashsmith-0.2.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hashsmith-0.2.2-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file hashsmith-0.2.2.tar.gz.

File metadata

  • Download URL: hashsmith-0.2.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.11.12 Darwin/24.2.0

File hashes

Hashes for hashsmith-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5f8839a0b47728943aaae8a2fb76243d136d8a5b7fca2dd0c6f8e03a440e5ccf
MD5 f8bf85d565eb5755bb9a02180f98c930
BLAKE2b-256 c8dde93d9ab9ac354d4d0ddc553083299a0f771bfb7ed86dd275bf7069129be2

See more details on using hashes here.

File details

Details for the file hashsmith-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: hashsmith-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 13.1 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

Hashes for hashsmith-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f8c13aff44d2e7e3c745f392be1e8fde41b5ca79fae7aed4438f315f0a7a6b1c
MD5 567d30fd446ce33cfbca16d2a4b7633b
BLAKE2b-256 ae11039a2a8942c2333139b48692e296118d1d39f37c4e63a3e72b29077eeecf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page