genpw-go

command module
v2.0.15+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 6 Imported by: 0

README

genpw

Gitpod Ready-to-Code

genpw is a command-line tool that generates strings of random characters that can be used as reasonably secure passwords.

Passwords are, by default, chosen from the union of three character classes:

  • all upper-case letters except I and O
  • all lower-case letters except l
  • the digits 2 through 9

0 and O are not used to avoid confusion with each other when passwords are displayed in sans-serif fonts. I, l, and 1 are not used for the same reason.

Options can be given to omit any one or any two of these character classes. For instance, you can omit uppercase letters and digits by passing -upper=false -digit=false to genpw. This will return a password composed only of lowercase letters.

Passwords are guaranteed to contain at least one of each selected character class. The default length is 16. genpw will create a password of any length greater than or equal to the number of character classes selected.

If the password length is less than or equal to the total number of characters selected, genpw will not repeat characters within the generated password.

Installation

I use this repository to experiment with goreleaser, so there are a ridiculous number of builds and packages available for such a trivial app. Don't judge.

Homebrew (macOS or Linux)
brew install markcornick/tap/genpw
Scoop (Windows)
scoop bucket add markcornick https://github.com/markcornick/scoop-bucket.git
scoop install genpw
Snap (Linux)
snap install genpw
Docker
docker run --rm markcornick/genpw
Binaries and RPM/DEB packages

Here. Checksums from that page are signed with my GPG key.

go get
go get github.com/markcornick/genpw

Usage

$ genpw -help
Usage of genpw:
  -digit
        Include digits (default true)
  -length int
        Length to generate (default 16)
  -lower
        Include lowercase letters (default true)
  -upper
        Include uppercase letters (default true)

$ genpw
h6ECtbDZPnRddHV7
$ genpw -length=8
XdWod8f8
$ genpw -length=64
QhESpeyPDidxV9kFNCrJqeMa4XUYbET4B3s5oGA8kYsV6XwDKHrCL7wojGZm9gj5
$ genpw -length=0
2017/10/31 16:04:47 Invalid length - must be an integer greater than 2
$ genpw -lower=false
387HNFDEUW4YGMZA
$ genpw -upper=false -length=8
hcsym6tj
$ genpw -lower=false -upper=false -length=32
92992759356835354563826487673794
$ genpw -lower=false -upper=false -digit=false
2019/08/17 04:29:15 Must include at least one of -lower, -upper and/or -digit
exit status 1

For compatibility with earlier versions of genpw, the length can also be specified as an integer following any flags. A length specified in this manner will override the -length flag.

$ genpw 64
gXBd8yVV3QRL9yDxheEiadMSqK4w5CJjF6UAc8JZpkxgaAznDRerTSX2pKnEmhUW
$ genpw -upper=false 8
75vuwbad
$ genpw -lower=false -upper=false 32
92992759356835354563826487673794

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/markcornick/genpw.

This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

genpw is available as open source under the terms of the MIT License.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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