Documentation ¶
Overview ¶
Package pgen is a password generator tool to create random passwords The idea of this package came from https://github.com/Luzifer/password
Example ¶
Example generates 3 passwords
package main import ( "fmt" "github.com/xumak-grid/go-grid/pkg/pgen" ) func main() { g := pgen.NewGenerator() p1, _ := g.GeneratePassword(10, true) p2, _ := g.GeneratePassword(15, true) fmt.Println(p1, p2) // Changing specials characters (numerics, letters, specials) g.CharacterTables["specials"] = "*/-$" p3, _ := g.GeneratePassword(20, true) fmt.Println(p3) }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ( // MinimumLength the minimum length of a password MinimumLength = 8 // ErrMinLengthRequired represents the minimum length error ErrMinLengthRequired = customError("minimum length error " + string(MinimumLength)) // CharacterNumerics all numbers CharacterNumerics = "0123456789" // CharacterLetters all letters CharacterLetters = "abcdefghijklmnopqrstuvwxyz" // CharacterSpecials all special characters CharacterSpecials = "!#$%&()*+,-_./:;=?@[]^{}~|" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.