Skip to content
kanywstPublic

About

Cost calculator for offline password brute-force attacks: time + USD per GPU profile, with a CI gatekeeper.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

173 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

brtc

Stop guessing password strength. Calculate the actual bill.

Build Status Release Go Reference License: MIT


brtc is a cost calculator, not a strength meter. It converts an entropy/guess count into an offline-attack price tag in USD against a chosen GPU or cloud profile. By default it does not detect dictionary words, leetspeak, keyboard walks, or other patterns β€” P@ssw0rd! looks "strong" by raw entropy alone but is trivially guessable in practice. For real-world strength, pass --zxcvbn to swap the naive estimator for the built-in zxcvbn pattern analyzer, and --hibp to check the password against Have I Been Pwned (a breached password is COMPROMISED no matter its entropy). You can still feed an external guess count via --guesses.

brtc (Brute-force Cost) is a CLI tool that translates abstract concepts like "entropy" into harsh reality: exactly how much time and cloud infrastructure money it takes to crack a password.

Instead of just telling you a password is "Weak" or "Strong", brtc pits your string against an RTX 4090 rig or an AWS 8x H100 cluster running bcrypt, and gives you the receipt.

Demo

brtc demo animation

Features

  • Financial Cost Visualization: Uses current spot prices for AWS or GPU providers to calculate the total USD cost to crack your hash.
  • Hardware Simulation: Select between various physical and cloud profiles (rtx-5090, rtx-4090, rx-7900xtx, rtx-3060, gtx-1080ti, mac-m3-max, mac-m3, cpu-standard, aws-p5.48xlarge, raspberry-pi-4) to see how hardware scales the threat. Baselines are 2026 hashcat numbers (RTX 5090 Blackwell is the current top cracker).
  • Hash Algorithms: Simulates the braking power of md5, sha1, sha256, ntlm, bcrypt, argon2id, and pbkdf2-sha256 with adjustable work factors.
  • Pattern-Aware Strength: Pass --zxcvbn to estimate real guessability with the built-in zxcvbn analyzer instead of naive R^L entropy, or --hibp to flag passwords found in Have I Been Pwned via privacy-preserving k-anonymity.
  • Terminal UI: Color-coded output with a one-line verdict banner and an entropy gauge, built on Lipgloss.
  • CI/CD Gatekeeper: Break the build on --fail-under-time (cracked faster than e.g. 1y, 30d), --fail-under-entropy (below e.g. 60 bits), or --fail-on-breach (found in Have I Been Pwned) β€” alone or combined. Also supports standard json and sarif outputs for tooling.

Why This Matters (Online vs. Offline Attacks)

sequenceDiagram
    participant A as Attacker
    participant S as Server (Online)
    participant GPU as Local GPU (Offline)
    
    %% Online Attack Scenario
    Note over A, S: πŸ”΄ Online Attack (Live Login Screen)
    A->>S: Try "admin123" (Speed: 10/sec)
    S-->>A: Incorrect
    A->>S: Try "password1"
    S-->>A: Incorrect
    A->>S: Try "qwerty99"
    S--xA: ❌ Blocked by WAF / Account Locked
    
    %% Offline Attack Scenario
    Note over A, GPU: 🟒 Offline Attack (brtc Simulates This)
    A->>S: Exploit Vulnerability
    S-->>A: πŸ“¦ Steal DB Password Hashes
    Note over A, GPU: Attacker takes hashes offline
    A->>GPU: ⚑ Feed hash to RTX 4090
    loop Billions of guesses per second
        GPU-->>GPU: Hash "a", "b", "c"...
        GPU-->>GPU: Hash "P@ssw0rd123"
    end
    GPU-->>A: βœ… Match Found: "P@ssw0rd123"
Loading

You might wonder: "Why do I care about an RTX 4090? A login screen will lock me out after 5 attempts anyway."

That's true for Online Attacks (guessing passwords on a live website). Rate limits, WAFs, and network latency make brute-forcing over the internet practically impossible.

However, brtc calculates the cost of an Offline Attack. When a database is breached and password hashes are dumped, the attacker doesn't need to interact with the login screen anymore. They can take those hashes to their own private GPU cluster and run guesses at the maximum speed the hardware allows, entirely bypassing rate limits and lockouts.

At that point, the only things standing between the attacker and your users' plain-text passwords are:

  1. The Length & Complexity (Entropy) of the passwords.
  2. The Work Factor of the hashing algorithm (like bcrypt or argon2id) intentionally severely slowing down their GPUs.

brtc shows exactly what happens when that final, brutal math equation plays out.

Installation

Assuming you have Go 1.25+ installed:

go install github.com/kanywst/brtc/v2@latest

Usage

Just pass the password as an argument:

brtc "P@ssw0rd123!"

Or pipe it in:

echo "P@ssw0rd123!" | brtc

Surrounding whitespace is trimmed, so the newline echo adds does not count. brtc analyzes one password per run and rejects stdin that holds more than one line, rather than scoring the lines as a single long password.

Options

Flag Default Description
--hw rtx-4090 The attacker's hardware profile (rtx-5090, rtx-4090, rx-7900xtx, rtx-3060, gtx-1080ti, mac-m3-max, mac-m3, cpu-standard, aws-p5.48xlarge, raspberry-pi-4). An unrecognized name is an error, not a fallback β€” a typo would otherwise model slower hardware and let a --fail-* gate pass
--algo bcrypt The target hash algorithm (md5, sha1, sha256, ntlm, bcrypt, argon2id, pbkdf2-sha256). Unrecognized names are rejected for the same reason as --hw: they used to be modeled as bcrypt, the slowest algorithm here, so a typo let a --fail-* gate pass
--cost 10 Work factor (bcrypt, 4–31), time iterations (argon2id, 1+) or iteration count (pbkdf2-sha256, 1+). Required for pbkdf2-sha256: its strength is the iteration count, and no default is safe to assume. Rejected for the single-pass algorithms, which have no work factor, and rejected outside the range the algorithm can represent β€” brtc would otherwise report a work factor it clamped away
--memory "" Argon2id memory parameter (e.g. 64m, 128m, 1g). Defaults to the profile baseline (64MB). Rejected for any other algorithm, which would silently discard it
--guesses "" Override entropy with an external guess count from zxcvbn or similar (e.g. 1e10, 12345). Makes the password argument optional
--zxcvbn false Use the built-in zxcvbn pattern analyzer instead of naive R^L entropy β€” catches dictionary words, keyboard walks, and l33t (P@ssw0rd! β†’ seconds)
--hibp false Check the password against Have I Been Pwned via k-anonymity (only the SHA-1 prefix is sent; requires network). A breached password reads COMPROMISED regardless of entropy
--budget "" Set an attacker budget (e.g. 1000usd) to see the max characters they can afford to crack
--output, -o tui Output format (tui, table, json, sarif)
--fail-under-time "" CI/CD gate: fail the run if the password cracks faster than this (e.g., 1y, 30d, 12h)
--fail-under-entropy 0 CI/CD gate: fail the run if the estimated entropy is below this many bits (e.g. 60, 80)
--fail-on-breach false CI/CD gate: fail the run if the password appears in Have I Been Pwned. Implies --hibp, and a lookup that cannot be completed also fails the gate
--all-hw false Compare the password across every hardware profile at once (not combinable with --budget, the --fail-* gates, or -o sarif)
--version - Print the binary version and exit

Example Outputs

Beautiful TUI

brtc --algo bcrypt --cost 12 --hw aws-p5.48xlarge "shortpass"

Plain Table (no colors)

A colour-free, pipe-friendly aligned table for logs, docs, or terminals where the TUI is noise:

brtc -o table "P@ssw0rd123!"

JSON for Automation

brtc -o json "P@ssw0rd123!" | jq .

When stdout is not a terminal (a pipe, a file, or a CI log) and no -o is given, brtc automatically uses json instead of the TUI, so piping never produces escape codes. Pass -o tui to force the interactive view.

Reports say when the hardware numbers were last checked: baseline_reviewed (plus baseline_source) in JSON, Baseline Date in the TUI and table, and baseline_reviewed per row in --all-hw -o json. Once that date is more than a year old, brtc prints a warning to stderr and sets baseline_stale: true in either JSON shape: newer GPUs and cheaper rentals mean the real crack time and cost are likely lower than shown. The warning never changes the exit code; the gates still decide that.

Compare Every Hardware Profile

See, at a glance, how the same password fares against every attacker β€” from a Raspberry Pi to an 8x H100 cluster β€” sorted fastest-first:

brtc --all-hw --algo bcrypt --cost 12 "P@ssw0rd!"
# HARDWARE         HASHRATE  TIME TO CRACK         COST
# aws-p5.48xlarge  9.4 kH/s  969.0 thousand years  $339.6 billion
# rtx-5090         2.4 kH/s  3.8 million years     $10.0 billion
# rtx-4090         1.4 kH/s  6.3 million years     $19.4 billion
# ...              ...       ...                   owned

Note the cost column: the aws-p5.48xlarge (8x H100) box is the fastest here but by far the most expensive per crack. Password cracking is integer/bitwise work, not tensor work, so datacenter AI GPUs are poor value β€” a rented consumer RTX 5090 at ~$0.30/hr cracks the same hash for a fraction of the price. Baselines are 2026 hashcat numbers.

Add -o json for a machine-readable array.

CI Gatekeeper Example

There are three independent gates. Use any one alone, or combine them β€” the run fails on the first one that trips:

brtc --fail-under-time 1d "short"
# Error: gatekeeper failed: estimated crack time (17.2 minutes) is less than required (1.0 days)
# Exit code 1

brtc --fail-under-entropy 60 "short"
# Error: gatekeeper failed: estimated entropy (23.5 bits) is less than required (60.0 bits)
# Exit code 1

brtc --fail-on-breach "P@ssw0rd"
# Error: gatekeeper failed: password found in 6421042 known breaches
# Exit code 1

--fail-on-breach turns on the Have I Been Pwned lookup by itself, so you don't have to remember --hibp alongside it. --hibp on its own stays report-only β€” it prints COMPROMISED but leaves the exit code at 0 β€” so adding the breach check to an existing command never silently changes its exit status. A breach also fails a bare --fail-under-time gate, as it always has.

Because a gate that could not be evaluated must not report a pass, --fail-on-breach treats a failed HIBP lookup (network down, API error) as a failure, unlike plain --hibp, which only warns.

When --fail-under-time is set, brtc also reports the minimum password length needed to survive that threshold on the chosen hardware (shown as Recommended Len in the TUI and recommended_chars in JSON) β€” turning the gate into actionable advice.

GitHub Actions

To run the same gates in a workflow, use the GitHub Action in this repository. It builds brtc on the runner, passes the secret over stdin, fails the job when a gate trips, and exposes the JSON fields (or a SARIF file) as step outputs:

- uses: kanywst/brtc@v2
  with:
    password: ${{ secrets.SERVICE_PASSWORD }}
    algorithm: bcrypt
    cost: "12"
    fail-under-time: 1y

Inputs, outputs, SARIF upload, zxcvbn pairing and versioning are in docs/github-action.md. The action used to live in kanywst/brtc-action; moving to it is a one-line change from kanywst/brtc-action@v2 to kanywst/brtc@v2.

Pattern-aware strength (--zxcvbn) and breach check (--hibp)

brtc's default estimator is naive β€” it counts character classes and treats every position as independent, so P@ssw0rd! looks "strong" to it. Pass --zxcvbn to use the built-in pattern analyzer instead, which recognizes the dictionary word, l33t substitutions, and structure:

brtc --algo bcrypt "P@ssw0rd!"           # naive R^L: ~1.6 million years
brtc --algo bcrypt --zxcvbn "P@ssw0rd!"  # zxcvbn: Less than a second

Add --hibp to check the password against Have I Been Pwned. Only the first 5 hex characters of the SHA-1 hash are sent (k-anonymity), so the password never leaves your machine. A breached password reads COMPROMISED regardless of entropy:

brtc --hibp "password"
# HIBP Breaches: found 52372427 times (COMPROMISED)

You can also feed an external guess count (e.g. from a JS/TS zxcvbn build) via --guesses:

guesses=$(zxcvbn-cli "P@ssw0rd!" --json | jq -r .guesses)
brtc --guesses "$guesses" --algo bcrypt --cost 12

Argon2id Memory Sweep

Argon2id is a memory-hard function. Bumping the memory parameter is a defender's most effective lever against GPU attacks:

brtc --algo argon2id --memory 64m  -o json "P@ssw0rd!" | jq .cost_usd
brtc --algo argon2id --memory 256m -o json "P@ssw0rd!" | jq .cost_usd
brtc --algo argon2id --memory 1g   -o json "P@ssw0rd!" | jq .cost_usd

PBKDF2-HMAC-SHA256 (Django's default hasher, and what OWASP recommends at 600,000 iterations) takes its iteration count through --cost, which is required for it. The per-iteration rate is modeled as half the profile's sha256 rate (two SHA-256 compressions per iteration), not measured:

brtc --algo pbkdf2-sha256 --cost 600000 "P@ssw0rd!"
brtc --algo pbkdf2-sha256 --cost 1000   "P@ssw0rd!"   # a legacy deployment

Development

Standard Go toolchain layout:

make test      # Run all tests
make lint      # Run golangci-lint
make format    # go fmt & go mod tidy
make vuln      # Check for known vulnerabilities via govulncheck
make build     # Build the binary directly

License

MIT

About

Cost calculator for offline password brute-force attacks: time + USD per GPU profile, with a CI gatekeeper.

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages