becrypt

command module
v1.3.26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: MIT Imports: 7 Imported by: 0

README

Go Report Card GoDoc GitHub run-ci

becrypt

Generate and check bcrypt hashes from a CLI

  • Version: 1.3.26
  • License: MIT
  • Repo: github.com/pepa65/becrypt
  • Modified interface from github.com/shoenig/bcrypt-tool:
    • Shorter & simpler, and only a command for the least used option.
    • No password on the commandline (either piped-in or asked for interactively).
    • Functionally compatible (both use golang.org/x/crypto/bcrypt under the hood).

Usage

becrypt v1.3.26 - Generate and check bcrypt hashes from a CLI
Repo:   github.com/pepa65/becrypt
Usage:  becrypt OPTION
    Options:
        help|-h|--help           Display this HELP text.
        cost|-c|--cost <hash>    Display the COST of bcrypt <hash>.
        <hash> [-q|--quiet] ^    CHECK the password against bcrypt <hash>.
        [<cost>] ^               Generate a HASH from the given password
                                 (optional <cost>: 4..31, default: 10).
^ Password: can be piped-in or prompted for; it's cut off after 72 characters.

Install from Releases

  • The becrypt tool is available from the Releases page.
  • Pre-compiled for:
    • OSX amd64 arm64
    • Linux amd64 386 arm64
    • FreeBSD amd64 386 arm64
    • Openbsd amd64 386 arm64
    • Windows amd64 386 arm64
    • Plan9 amd64 386

Build from source with Go

go get github.com/pepa65/becrypt

Examples

Quote the password/hash! (Depending on your shell.)

COST: Determine processing Cost of Hash
becrypt cost '$2a$10$nWFwjoFo4zhyVosdYMb6XOxZqlVB9Bk0TzOvmuo16oIwMZJXkpanW'

The result of a COST command is a plaintext 10-based number on stdout with returncode 0, unless the hash is malformed, then an error results for a returncode bigger than 0).

CHECK: Determine if Password matches Hash
# A password will be asked for interactively
becrypt '$2a$10$nWFwjoFo4zhyVosdYMb6XOxZqlVB9Bk0TzOvmuo16oIwMZJXkpanW'

printf 'p4ssw0rd' |becrypt '$2a$10$nWFwjoFo4zhyVosdYMb6XOxZqlVB9Bk0TzOvmuo16oIwMZJXkpanW'

The result of a CHECK command is a plaintext 'yes' or 'no' on stdout, with corresponding returncodes 0 and 1. If the -q or --quiet flag is given, no stdout is produced, only the returncode.

HASH: Generate Hash from a Password
becrypt  # A password will be asked for interactively

printf 'p4ssw0rd' |becrypt

The result of a HASH command is the hash on stdout, with a returncode of 0.

HASH: Generate Hash from a Password with given Cost
becrypt 31  # A password will be asked for interactively

printf 'p4ssw0rd' |becrypt 4

The processing cost scales exponentially with 2^cost, so a cost increase of 1 doubles the processing time needed. So higher cost numbers will take a while!

Release management

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL