A CLI tool for bcrypt - hash a password, determine if password matches a hash, compute cost of hash
Find a file
2026-02-23 01:41:27 +01:00
.github build(deps): bump goreleaser/goreleaser-action from 6 to 7 2026-02-22 23:55:24 +01:00
.gitignore Add .idea to .gitignore 2026-02-22 17:01:19 +01:00
.goreleaser.yaml Release archives now contain an intermediate directory 2026-02-23 01:41:27 +01:00
CHANGELOG.md Release archives now contain an intermediate directory 2026-02-23 01:41:27 +01:00
go.mod Switch to upstream Kong. 2026-02-23 01:41:27 +01:00
go.sum Switch to upstream Kong. 2026-02-23 01:41:27 +01:00
LICENSE Add myself to LICENSE 2026-02-22 23:34:27 +01:00
main.go Prepare release v2.0.0 2026-02-22 23:18:01 +01:00
main_test.go Switch CLI parsing to Kong 2026-02-22 17:01:41 +01:00
README.md Remove unbuilt architectures 2026-02-22 23:50:20 +01:00

bcrypt-tool

bcrypt-tool is a dandy CLI tool for generating and matching bcrypt hashes

It is forked from shoening/bcrypt-tool, but deviates in CLI.

Installation

Install from Releases

The bcrypt-tool tool is available from the Releases page.

It is pre-compiled for many operating systems and architectures including

  • Linux
  • Windows
  • MacOS

Build from source

The bcrypt-tool command can be compiled by running

$ go install github.com/Necoro/bcrypt-tool@latest

Usage

bcrypt-tool [action] [flags] parameter ...

Password Provision

The password can be provided by different means:

  • as a direct argument. Note that the password may be (shortly) visible in process browsers (like ps aux or top).
  • on stdin, i.e., by piping the password (gen-pwd | bcrypt-tool hash or bcrypt-tool hash < password_file)
  • interactively. bcrypt-tool queries for the password if it has not been provided by the previous means and is connected to a terminal

Actions

hash
Use bcrypt to generate a hash from the provided password and optional cost (431).
match
Use bcrypt to check if a password matches a hash.
cost
Use bcrypt to determine the cost of a hash (431).

Examples

Generate hash from a directly provided password

$ bcrypt-tool hash p4ssw0rd

Generate hash as output from pass

$ pass some/pwd | bcrypt-tool hash

Generate hash from an interactively provided password with cost

$ bcrypt-tool hash --cost 31
Password:

Determine if password from file matches hash

$ bcrypt-tool match '$2a$10$nWFwjoFo4zhyVosdYMb6XOxZqlVB9Bk0TzOvmuo16oIwMZJXkpanW' < password_file

Determine cost of hash

$ bcrypt-tool cost '$2a$10$nWFwjoFo4zhyVosdYMb6XOxZqlVB9Bk0TzOvmuo16oIwMZJXkpanW'

License

This module is open source under the MIT license.