pwgen

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package pwgen allows generating random passwords given charsets, length limits, and target entropy.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidLenBounds = errors.New("bad length bounds")

ErrInvalidLenBounds represents bad minLen/maxLen values.

Functions

func GenPW

func GenPW(charsetsEnumerated []string, entropyWanted float64, minLen, maxLen int) (string, error)

GenPW generates a random password using characters from the charsets enumerated by charsetsEnumerated. At least one element of each charset is used. Available charsets are "lowercase", "uppercase", "numbers", "symbols", "latin1", latinExtendedA", "latinExtendedB", and "ipaExtensions". "latin" is also available: it's equivalent to specifying "latin1 latinExtendedA latinExtendedB ipaExtensions". Anything else will be treated as a string containing runes of a new custom charset to use. If entropyWanted is 0, the generated password has at least 256 bits of entropy; otherwise, it has entropyWanted bits of entropy. minLen and maxLen are ignored when set to zero; otherwise, they set lower/upper bounds on password character count and override entropyWanted if necessary.

Types

This section is empty.

Jump to

Keyboard shortcuts

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