Password generator written in Go

Overview

go-generate-password

GoDoc Build Status Go Report Card Release codecov

Password generator written in Go. Use as a library or as a CLI.

Usage

CLI

go-generate-password can be used on the cli, just install using: go get github.com/m1/go-generate-password/cmd/go-generate-password

To use:

➜  go-generate-password --help
go-generate-password is a password generating engine written in Go.

Usage:
  go-generate-password [flags]

Flags:
      --characters string   Character set for the config
      --exclude-ambiguous   Exclude ambiguous characters (default true)
      --exclude-similar     Exclude similar characters (default true)
  -h, --help                help for go-generate-password
  -l, --length int          Length of the password (default 24)
      --lowercase           Include lowercase letters (default true)
      --numbers             Include numbers (default true)
      --symbols             Include symbols (default true)
  -n, --times int           How many passwords to generate (default 1)
      --uppercase           Include uppercase letters (default true)

For example:

➜  go-generate-password
5PU?rG-w9YkDus4?AbmKd+Z*

More detailed example:

➜  go-generate-password -n 5 --length 16 --symbols=false
X89R4HvATgg7HSKk
YMwMPnXp7cnMTNdZ
RZWKAvyxFxDWRB8u
PvKb6uP4N7vAMVsD
KHttvhevGrTYptM5

Example using custom character set:

➜  go-generate-password -n 5 --characters=abcdefg01       
10cecfcfe0bea1fdcbb1afcf
bfcgbgg0dccafdacdaa1de01
gb0ggcffcefae0bb1ac0bbge
abafbc1bbaff0cfbdgaee11d
1fge0fcbccabda0g0a01ffc0

Library

To use as a library is pretty simple:

config := generator.Config{
		Length:                     16,
		IncludeSymbols:             false,
		IncludeNumbers:             true,
		IncludeLowercaseLetters:    true,
		IncludeUppercaseLetters:    true,
		ExcludeSimilarCharacters:   true,
		ExcludeAmbiguousCharacters: true,
	}
g, _ := generator.New(&config)

pwd, _ := g.Generate() 
// pwd = 8hp43B2R7gaXrZUW

pwds, _ := g.GenerateMany(5)
// pwds = [
//   dnPp2TW2e8wmkAwT,
//   XVYwWn25xuNwhUTy,
//   vQ8aSrustQzxQCkA,
//   AuT4fu5RU9TtxEUR,
//   muDwwBRpKpC5BcHr,
// ]

pwd, _ = g.GenerateWithLength(12)
// pwd = HHhpzRGsmEWt

pwds, _ := g.GenerateManyWithLength(5, 12)
// pwds = [
//   s5TKYPdgRzvZ
//   wZFgzs8PUvRg
//   tU73qZ9sPzEs
//   mMaYU6hkvxPQ
//   KBNZ2D7cVQS2
// ]

The library also comes with some helper constants:

const (
	// LengthWeak weak length password
	LengthWeak = 6

	// LengthOK ok length password
	LengthOK = 12

	// LengthStrong strong length password
	LengthStrong = 24

	// LengthVeryStrong very strong length password
	LengthVeryStrong = 36

	// DefaultLetterSet is the letter set that is defaulted to - just the
	// alphabet
	DefaultLetterSet = "abcdefghijklmnopqrstuvwxyz"

	// DefaultLetterAmbiguousSet are letters which are removed from the
	// chosen character set if removing similar characters
	DefaultLetterAmbiguousSet = "ijlo"

	// DefaultNumberSet the default symbol set if character set hasn't been
	// selected
	DefaultNumberSet = "0123456789"

	// DefaultNumberAmbiguousSet are the numbers which are removed from the
	// chosen character set if removing similar characters
	DefaultNumberAmbiguousSet = "01"

	// DefaultSymbolSet the default symbol set if character set hasn't been
	// selected
	DefaultSymbolSet = "!$%^&*()_+{}:@[];'#<>?,./|\\-=?"

	// DefaultSymbolAmbiguousSet are the symbols which are removed from the
	// chosen character set if removing ambiguous characters
	DefaultSymbolAmbiguousSet = "<>[](){}:;'/|\\,"
)
Issues
  • Change password length from int to uint

    Change password length from int to uint

    Change the variable types from int to uint for password length and number of generated strings. Done to avoid trying to have a password with a negative length

    opened by GeistInDerSH 2
Releases(v0.2.0)
Owner
Miles Croxford
Senior Software Engineer
Miles Croxford
Not Yet Another Password Manager written in Go using libsodium

secrets Secure and simple passwords manager written in Go. It aims to be NYAPM (Not Yet Another Password Manager), but tries to be different from othe

Jarmo Pertman 28 May 30, 2022
Password manager written in golang

Go password manager Password manager written in golang. Dependencies: gpg golang

demn 2 Dec 2, 2021
A light package for generating and comparing password hashing with argon2 in Go

argon2-hashing argon2-hashing provides a light wrapper around Go's argon2 package. Argon2 was the winner of the Password Hashing Competition that make

Andrey Skurlatov 17 Mar 29, 2022
Argon2 password hashing package for go with constant time hash comparison

argon2pw Argon2 password hashing package with constant time hash comparison Preface: Argon2 was selected as the winner of the Password Hashing Competi

Raja Bhatia 88 Jun 26, 2022
Validate the Strength of a Password in Go

go-password-validator Simple password validator using raw entropy values. Hit the project with a star if you find it useful ⭐ Supported by Qvault This

Lane Wagner 341 Jun 20, 2022
:key: Idiotproof golang password validation library inspired by Python's passlib

passlib for go Python's passlib is quite an amazing library. I'm not sure there's a password library in existence with more thought put into it, or wi

Hugo Landau 267 Jun 10, 2022
A convenience library for generating, comparing and inspecting password hashes using the scrypt KDF in Go 🔑

simple-scrypt simple-scrypt provides a convenience wrapper around Go's existing scrypt package that makes it easier to securely derive strong keys ("h

Matt Silverlock 180 Jun 8, 2022
A simple Go script to brute force or parse a password-protected PKCS#12 (PFX/P12) file.

A simple Go script to brute force or parse a password-protected PKCS#12 (PFX/P12) file.

Evi1cg 32 Jun 12, 2022
EarlyBird is a sensitive data detection tool capable of scanning source code repositories for clear text password violations, PII, outdated cryptography methods, key files and more.

EarlyBird is a sensitive data detection tool capable of scanning source code repositories for clear text password violations, PII, outdated cryptograp

American Express 492 Jun 16, 2022
Secure Remote Password library for Go

go-srp NOTE: This is a port of node-srp to Go. I recommend reading their README for general information about the use of SRP. Installation go get gith

Kong 38 Jun 2, 2022
password manager using age for encryption

page ====== password manager using age (https://age-encryption.org/) for encryption. encrypted secrets are files in the $PAGE_SECRETS/ directory that

null 5 May 30, 2022
Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain.

pinentry-touchid Custom GPG pinentry program for macOS that allows using Touch ID for fetching the password from the macOS keychain. Macbook Pro devic

Jorge Luis Betancourt 209 Jun 18, 2022
A Go Module to interact with Passbolt, a Open source Password Manager for Teams

go-passbolt A Go Module to interact with Passbolt, a Open source Password Manager for Teams This Module tries to Support the Latest Passbolt Community

Samuel Lorch 10 May 13, 2022
ZipExec is a Proof-of-Concept (POC) tool to wrap binary-based tools into a password-protected zip file.

ZipExec ZipExec is a Proof-of-Concept (POC) tool to wrap binary-based tools into a password-protected zip file. This zip file is then base64 encoded i

Tylous 903 Jun 25, 2022
GoLang script that checks for password leaks by sending email address to the BreachDirectory API

GoLang script that checks for password leaks by sending email address to the BreachDirectory API

null 11 Feb 17, 2022
User enumeration and password bruteforce on Azure, ADFS, OWA, O365 and gather emails on Linkedin

goEnumBruteSpray Description Summary The recommended module is o365 for user enumeration and passwords bruteforce / spray . Additional information can

null 284 Jun 13, 2022
Simple password manager app in GO

Introduction This is my first project in Go, a password manager application. A humble attempt at execution of an idea I've had for some time now. The

Dhruv 12 Jan 16, 2022
Argon2 password hashing for Golang

Argon2 This is simple pure Golang implementation for password hash using Argon2. Usage package main import ( "fmt" "github.com/prastuvwxyz/argon2"

Dwi Agung Prastya 2 Dec 6, 2021