Help us shape the future of Go! Take the 2026 Go Developer Survey

password

package
v1.37.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LowercaseLetters = "abcdefghijklmnopqrstuvwxyz"
	UppercaseLetters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	Digits           = "0123456789"
	// - exclude special chars which could interfere with command line arguments, URL (rfc3986 gen-delims),
	// or connection strings, e.g. =,$,...
	Symbols          = "-_.{}~()*+!" // exclude &<>=;,`'^%$#@/:[]
	LettersAndDigits = LowercaseLetters + UppercaseLetters + Digits
)

Variables

This section is empty.

Functions

func FromAlphabet

func FromAlphabet(alphabet string, length uint) (string, error)

FromAlphabet generates a password of a given length, using only characters from the given alphabet (which should be a string with no duplicates)

func Generate

func Generate(config GenerateConfig) (string, error)

Generate generates a password based on the provided configuration. It takes an `azure.AutoGenInput` configuration as input and returns the generated password as a string. If any error occurs during the generation process, it returns an error.

func Shuffle

func Shuffle[T any](s []T) error

Fisher-Yates shuffle

Types

type GenerateConfig

type GenerateConfig struct {
	Length     uint  `json:"length,omitempty"`
	NoLower    *bool `json:"noLower,omitempty"`
	NoUpper    *bool `json:"noUpper,omitempty"`
	NoNumeric  *bool `json:"noNumeric,omitempty"`
	NoSpecial  *bool `json:"noSpecial,omitempty"`
	MinLower   *uint `json:"minLower,omitempty"`
	MinUpper   *uint `json:"minUpper,omitempty"`
	MinNumeric *uint `json:"minNumeric,omitempty"`
	MinSpecial *uint `json:"minSpecial,omitempty"`
}

GenerateConfig are the settings to control the output of calling Generate.

Jump to

Keyboard shortcuts

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