password

package
v1.40.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 4 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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