Package pwgen implements multiple popular password generate algorithms. It supports creating classic cryptic passwords with different character classes as well as more recent memorable approaches.
Some methods try to ensure certain requirements are met and can be very slow.
const ( // CharAlpha is the class of letters CharAlpha = upper + lower // CharAlphaNum is the class of alpha-numeric characters CharAlphaNum = digits + upper + lower // CharAll is the class of all characters CharAll = digits + upper + lower + syms )
GenerateExternal will invoke an external password generator, if set, and return it's output.
GenerateMemorablePassword will generate a memorable password with a minimum length
GeneratePassword generates a random, hard to remember password
GeneratePasswordCharset generates a random password from a given set of characters
GeneratePasswordCharsetCheck generates a random password from a given set of characters and validates the generated password with crunchy
GeneratePasswordWithAllClasses tries to enforce a password which contains all character classes instead of only enabling them. This is especially useful for broken (corporate) password policies that mandate the use of certain character classes for no good reason
Cryptic is a generator for hard-to-remember passwords as required by (too) many sites. Prefer memorable or xkcd-style passwords, if possible.
NewCryptic creates a new generator with sane defaults.
NewCrypticForDomain tries to look up password rules for the given domain or uses the default generator.
NewCrypticWithAllClasses returns a password generator that generates passwords containing all available character classes
NewCrypticWithCrunchy returns a password generators that only returns a password if it's successfully validated with crunchy.
Password returns a single password from the generator
|pwrules||Code generated by go generate gen.go.|