mirror of
https://github.com/Necoro/bcrypt-tool.git
synced 2026-02-25 19:20:35 +01:00
A CLI tool for bcrypt - hash a password, determine if password matches a hash, compute cost of hash
- Go 100%
| .github | ||
| .gitignore | ||
| .goreleaser.yaml | ||
| CHANGELOG.md | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| main.go | ||
| main_test.go | ||
| README.md | ||
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 auxortop). - on stdin, i.e., by piping the password (
gen-pwd | bcrypt-tool hashorbcrypt-tool hash < password_file) - interactively.
bcrypt-toolqueries 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 (4–31).
match- Use bcrypt to check if a password matches a hash.
cost- Use bcrypt to determine the cost of a hash (4–31).
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.