gogen

module
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2024 License: MIT

README

gogen

A tool for generating cryptographic keys and password hashes.

Installation

From source
go install github.com/idelchi/gogen/cmd/gogen@latest
From installation script
curl -sSL https://raw.githubusercontent.com/idelchi/gogen/refs/heads/dev/install.sh | sh -s -- -d ~/.local/bin

Usage

gogen [flags] command [flags]
Global Flags
-s, --show      Show the configuration and exit
-h, --help      Help for gogen
-v, --version   Version for gogen
Commands
key - Generate a cryptographic key

Generate keys of configurable length:

gogen key [flags]

Flags:
  -h, --help         Help for key command
  -l, --length int   Length of the key to generate (default 32)

Examples:

# Generate a 32-byte key (default)
gogen key

# Generate a 64-byte key
gogen key -l 64

# Key length must be between 32-512 bytes and a multiple of 4
hash - Hash a password

Hash passwords using bcrypt with configurable cost and benchmarking capabilities:

gogen hash [flags] password

Flags:
  -b, --benchmark   Run a benchmark on the password hash
  -c, --cost int    Cost of the password hash (4-31) (default 12)
  -h, --help        Help for hash command

Examples:

# Hash a password with default cost (12)
gogen hash password

# Hash with custom cost (4-31)
gogen hash -c 14 password

# Run benchmark to measure hashing performance across costs
gogen hash -b password
Environment Variables

All flags can be configured through environment variables using the GOGEN prefix:

  • GOGEN_SHOW: Show configuration
  • GOGEN_LENGTH: Key generation length
  • GOGEN_COST: Bcrypt cost factor
  • GOGEN_BENCHMARK: Enable benchmark mode

For detailed help on any command:

gogen --help
gogen <command> --help

Directories

Path Synopsis
cmd
gogen command
Command gogen provides cryptographic key generation and password hashing functionality.
Command gogen provides cryptographic key generation and password hashing functionality.
internal
commands
Package commands provides the command-line interface for the gogen tool.
Package commands provides the command-line interface for the gogen tool.
config
Package config defines the configuration structure and validation rules for the gogen tool.
Package config defines the configuration structure and validation rules for the gogen tool.
pkg
hash
Package hash provides functionality for secure password hashing and benchmarking using the bcrypt algorithm.
Package hash provides functionality for secure password hashing and benchmarking using the bcrypt algorithm.
key
Package key provides functionality for creating and managing cryptographic keys.
Package key provides functionality for creating and managing cryptographic keys.
validator
Package validator provides a wrapper around go-playground/validator with built-in translation support for validation error messages.
Package validator provides a wrapper around go-playground/validator with built-in translation support for validation error messages.

Jump to

Keyboard shortcuts

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