Documentation
¶
Overview ¶
Package pwgen allows generating random passwords given charsets, length limits, and target entropy.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidLenBounds = errors.New("bad length bounds")
ErrInvalidLenBounds represents bad minLen/maxLen values.
Functions ¶
func GenPW ¶
func GenPW(pwr PwRequirements) (string, error)
GenPW generates a random password using characters from the charsets enumerated by charsetsEnumerated. At least one element of each charset is used. 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. GenPW will *not* strip any characters from given charsets that may be undesirable (newlines, control characters, etc.), and does not preserve grapheme clusters.
Types ¶
type PwRequirements ¶
type PwRequirements struct { CharsetsWanted charsets.CharsetCollection TargetEntropy float64 MinLen, MaxLen int }
PwRequirements holds the parameters used for password generation. These include charsets to pick from and target strength.