gopass: github.com/justwatchcom/gopass/pkg/pwgen Index | Examples | Files | Directories

package pwgen

import "github.com/justwatchcom/gopass/pkg/pwgen"

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.

Index

Examples

Package Files

cryptic.go external.go memorable.go pwgen.go rand.go validate.go wordlist.go

Constants

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 GenerateExternal Uses

func GenerateExternal(pwlen int) (string, error)

GenerateExternal will invoke an external password generator, if set, and return it's output.

func GenerateMemorablePassword Uses

func GenerateMemorablePassword(minLength int, symbols bool) string

GenerateMemorablePassword will generate a memorable password with a minimum length

Code:

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

type Cryptic Uses

type Cryptic struct {
    Chars      string
    Length     int
    MaxTries   int
    Validators []func(string) error
}

Cryptic is a generator for hard-to-remember passwords as required by (too) many sites. Prefer memorable or xkcd-style passwords, if possible.

func NewCryptic Uses

func NewCryptic(length int) *Cryptic

NewCryptic creates a new generator with sane defaults.

func NewCrypticForDomain Uses

func NewCrypticForDomain(length int, domain string) *Cryptic

NewCrypticForDomain tries to look up password rules for the given domain or uses the default generator.

func NewCrypticWithAllClasses Uses

func NewCrypticWithAllClasses(length int) *Cryptic

NewCrypticWithAllClasses returns a password generator that generates passwords containing all available character classes

func NewCrypticWithCrunchy Uses

func NewCrypticWithCrunchy(length int) *Cryptic

NewCrypticWithCrunchy returns a password generators that only returns a password if it's successfully validated with crunchy.

func (*Cryptic) Password Uses

func (c *Cryptic) Password() string

Password returns a single password from the generator

Directories

PathSynopsis
pwrulesCode generated by go generate gen.go.
xkcdgen

Package pwgen imports 15 packages (graph) and is imported by 3 packages. Updated 2020-08-17. Refresh now. Tools for package owners.