Hashcat OpenCL Kernel & Module Generator

KernelBuilder

Auto-generate complete Hashcat plugins from PHP-like hash expressions. Pure OpenCL kernels for attack modes -a 0, -a 1, and -a 3 — no manual kernel coding required.

Python 3 OpenCL Nested Hashing Salt Support CUT / Truncate Endianness Aware
Overview

KernelBuilder is a Python port of the original C# tool that transforms simple hash expressions like md5(sha1($plain).sha256($salt)) into complete, compilable Hashcat plugins. It generates pure OpenCL kernels and the accompanying C module for hash parsing and encoding.

Write your hash as a PHP-style expression — the tool handles algorithm chaining, endianness conversion between little-endian (MD5) and big-endian (SHA-family) algorithms, salt concatenation in any order, and even truncated intermediate hashes (CUT). The output is a ready-to-compile plugin folder with all three attack modes supported.

Core Features
PHP-like expression parser
Intuitive syntax: md5($plain.$salt), sha1(md5($plain)), sha256($salt.$plain) — no OpenCL knowledge required.
🔗
Nested hash chaining
Arbitrarily deep nesting of MD5, SHA1, SHA224, and SHA256. The generator flattens the expression into optimized instruction sequences.
🧂
Salt & plain positioning
Concatenate $salt and $plain in any order with . dot notation. Automatic salt-length handling in the C module.
CUT truncation support
Truncate intermediate hashes to specific byte lengths with CUT<n>_ALGO syntax (multiples of 4 bytes).
🎯
Three attack modes
Generates pure kernels for -a 0 (rules), -a 1 (combinator), and -a 3 (mask/brute-force) automatically.
Endianness aware
Automatically handles LE→BE and BE→LE word swaps when feeding MD5 digests into SHA-family algorithms and vice versa.
Supported Algorithms
M5
MD5
16-byte digest, little-endian. OPTS_TYPE_PT_GENERATE_LE with 80-bit padding and 14-bit length counter.
S1
SHA1
20-byte digest, big-endian. OPTS_TYPE_PT_GENERATE_BE with 80-bit padding and 15-bit length counter.
S2
SHA224
28-byte digest, big-endian. Same padding scheme as SHA1 family.
S6
SHA256
32-byte digest, big-endian. Full 256-bit output for high-security hash chains.

All algorithms use Hashcat's standard inc_hash_*.cl headers for init/update/final functions. Output format is lowercase hex.

Installation & Requirements

Python 3.7+ and a Hashcat source tree for compiling the generated plugin.

# Clone the repository git clone https://github.com/A113L/hashcat-kernel-builder.git cd hashcat-kernel-builder # No Python dependencies required — pure stdlib python3 kernel_builder.py --list
Build requirements:
Hashcat source tree for compilation  ·  OpenCL headers  ·  C compiler (see Hashcat BUILD.md)
Usage Examples
# Simple MD5 of plaintext python3 kernel_builder.py 'md5($plain)' 98000 # SHA1 with salt prefix python3 kernel_builder.py 'sha1($salt.$plain)' 98001 # Nested: MD5 of SHA1 python3 kernel_builder.py 'md5(sha1($plain))' 98002 # SHA256 with salt, write directly to hashcat tree python3 kernel_builder.py 'sha256($salt.$plain)' 98003 --hashcat # List supported algorithms python3 kernel_builder.py --list
Command-Line Options
ArgumentDescription
algorithmHash expression, e.g. 'md5($plain)' or 'sha1($plain.$salt)'
IDKernel ID / Hashcat -m number (1–5 digits, e.g. 98000)
--overwriteOverwrite a previously generated plugin folder
--hashcatWrite directly into a Hashcat source tree's OpenCL/ and src/modules/ folders
-l, --listList supported algorithms and exit
Generated Plugin Layout
plugins/<ID>/ ├── OpenCL/ │ ├── m<ID>_a0-pure.cl # Rules attack (-a 0) │ ├── m<ID>_a1-pure.cl # Combinator attack (-a 1) │ └── m<ID>_a3-pure.cl # Mask attack (-a 3) └── src/modules/ └── module_<ID>.c # Hash parsing / encoding module

Copy the folders into your Hashcat source tree and rebuild. The generator produces both _sxx (single-hash) and _mxx (multi-hash) kernel variants for each attack mode.

Testing & Benchmarking
# Benchmark the new kernel (pure only, no -O) ./hashcat -b -m 98000 # Dictionary attack with rules ./hashcat -a0 -m 98000 hashes.txt wordlist.txt -r rules/best64.rule # Combinator attack ./hashcat -a1 -m 98000 hashes.txt left.txt right.txt # Mask attack ./hashcat -a3 -m 98000 hashes.txt ?l?l?l?l?l?l

Note: Do not pass -O — only pure kernels are generated. Hashcat would fail to find tiered symbol names (s04/m04) under optimized mode.

Get the Source

KernelBuilder is open source and hosted on GitHub. MIT licensed. Based on the original KernelBuilder by Penguinkeeper.

View KernelBuilder on GitHub