pcfg-go - The Fast PCFG
-
Title: pcfg-go
Author: cyclone
URL: https://github.com/cyclone-github/pcfg-go
Description: Probabilistic Context Free Grammar (PCFG) password generator in Pure Gopcfg-go - The Fast PCFG
- Probabilistic Context-Free Grammar (PCFG) password generator - Pure Go Edition
- pcfg-go is a Pure Go rewrite of the Python3 pcfg_cracker
- The goal of this Go implementation is to provide a substantial performance improvement over the original Python3 version, while also adding features such as supporting
$HEX[]input/output and multi-byte character support — which is not implemented in the Pure C pcfg_guesser - Credits for the original python3 pcfg_cracker belong to the author, lakiw
Install
pcfg_trainer:
go install -ldflags="-s -w" github.com/cyclone-github/pcfg-go/cmd/pcfg_trainer@mainpcfg_guesser:
go install -ldflags="-s -w" github.com/cyclone-github/pcfg-go/cmd/pcfg_guesser@main
Additions & improvements
- Performance — ~342% faster trainer, ~2,578% faster pcfg_guesser vs Python3 (see Benchmarks)
- $HEX[] input — Trainer accepts
$HEXencoded passwords in the training wordlist (multi-byte support) - Ctrl+C handling — Pressing Ctrl+C auto saves session on pcfg_guesser
- Multi-keyboard layouts — QWERTY, AZERTY, QWERTZ, Dvorak, JCUKEN (Russian Cyrillic)
- Expanded TLD list — Legacy, ccTLDs, gTLDs (
.info,.xyz,.app,.dev, etc.), and short TLDs (.co,.io,.ai,.me,.gg); improves both website and email detection - Improved website detection — Broader URL/prefix detection (
http://,https://,www., etc.) and host extraction - Multi-threaded architecture — pcfg_guesser is multi-threaded for increased performance
- Compiled binary — No fuss; pcfg-go uses compiled binaries for speed and easy deployment
Benchmarks on 1 million password training set
pcfg_trainer
Python3 trainer: 97.2 secondsGo pcfg_trainer: 22 seconds
pcfg_guesser
Python3 pcfg_guesser 195.5sGo pcfg_guesser 7.3s
Usage
pcfg_trainer
Train a new ruleset from wordlist:
pcfg_trainer -r rule_name -t wordlist.txtpcfg_guesser
Generate guesses from a trained ruleset:
pcfg_guesser -r rule_nameSession save/restore:
pcfg_guesser -r rule_name -s my_session # save to my_session.sav on exit pcfg_guesser -r rule_name -s my_session -l # load and resumePress Ctrl+C to save session and exit.
Piping into hashcat
pcfg_guesser -r rule_name -s my_session | hashcat -m 0 hashes.txt...
Flags
pcfg_trainer
pcfg-go vs pcfg-python3 flags
Go Python3 Description -r --rule Ruleset name -t --training Training wordlist (required) -e --encoding File encoding -C --comments Config comments -S --save_sensitive Save emails, URLs -p --prefixcount Lines prefixed with count -n --ngram OMEN ngram size (2-5) -a --alphabet Alphabet size for Markov -c --coverage PCFG vs OMEN coverage -m --multiword Pre-train multiword file -h --help Help -version --version Version info pcfg_guesser
pcfg-go vs pcfg-python3 flags
Go Python3 Description -r --rule Ruleset name -s --session Session name -l --load Load previous session -n --limit Max guesses -b --skip_brute Skip OMEN/Markov -a --all_lower No case mangling -d --debug Debug output -h --help Help -version --version Version info
Compile from source (linux)
Requires Go and Git.
git clone https://github.com/cyclone-github/pcfg-go.git cd pcfg-go go mod tidy mkdir -p bin go build -ldflags="-s -w" -o bin/pcfg_trainer ./cmd/pcfg_trainer go build -ldflags="-s -w" -o bin/pcfg_guesser ./cmd/pcfg_guesserInstall to $GOPATH/bin:
go install -ldflags="-s -w" ./cmd/pcfg_trainer go install -ldflags="-s -w" ./cmd/pcfg_guesser - Probabilistic Context-Free Grammar (PCFG) password generator - Pure Go Edition
-
https://github.com/cyclone-github/pcfg-go/releases/tag/v0.5.0
v0.5.0; 2026-03-16initial github release ### Overview Pure Go rewrite of the Python3 `pcfg_cracker`, designed as a near drop-in replacement with significant performance gains and expanded features ### Highlights ~3× faster trainer ~40× faster pcfg_guesser `$HEX[]` input/output support Full multi-byte / Unicode support (not supported in Compiled C Edition) Improved and expanded keyboard detection: Fixed/tuned: QWERTY, JCUKEN Added: AZERTY, QWERTZ, Dvorak Expanded detection for TLDs, URLs, and emails in trainer Auto-save and resume support in pcfg_guesser Multi-threaded for high-throughput performance -
v0.5.3; 2026-07-25
https://github.com/cyclone-github/pcfg-go/releases/tag/v0.5.3pcfg_guesser~2× faster than v0.5.2- ~2,578% faster than Python3 pcfg_guesser.py
- Reduce long-run RAM growth in
pcfg_guesser(priority-queue frontier)- Compact parse-tree representation (interned type IDs, packed nodes, arena reuse)
- Contiguous index-based heap (fewer per-item allocations)
- Reuse OMEN optimizer cache per worker
- Prefer
[]byteguess building to cut string churn
- Same generation logic; parallel stdout interleaving may differ across runs
- Rename
trainertopcfg_trainer
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login