gopass: Index | Examples | Files | Directories

package pwgen

import ""

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.



Package Files

pwgen.go wordlist.go


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

func GenerateMemorablePassword Uses

func GenerateMemorablePassword(minLength int, symbols bool) string

GenerateMemorablePassword will generate a memorable password with a minimum length


fmt.Println(GenerateMemorablePassword(12, false))

func GeneratePassword Uses

func GeneratePassword(length int, symbols bool) string

GeneratePassword generates a random, hard to remember password

func GeneratePasswordCharset Uses

func GeneratePasswordCharset(length int, chars string) string

GeneratePasswordCharset generates a random password from a given set of characters

func GeneratePasswordCharsetCheck Uses

func GeneratePasswordCharsetCheck(length int, chars string) string

GeneratePasswordCharsetCheck generates a random password from a given set of characters and validates the generated password with crunchy

func GeneratePasswordWithAllClasses Uses

func GeneratePasswordWithAllClasses(length int) (string, error)

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



Package pwgen imports 12 packages (graph) and is imported by 1 packages. Updated 2020-06-01. Refresh now. Tools for package owners.