mirror of
https://github.com/wneessen/apg-go.git
synced 2024-09-19 19:32:47 +02:00
Winni Neessen
82b015d819
Created a new file "main.go" to add a simple password generator script using the apg library. This piece of code generates a random password with a fixed length of 15 characters including special characters, numeric, lower and uppercase letters.
19 lines
399 B
Go
19 lines
399 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/wneessen/apg-go"
|
|
)
|
|
|
|
func main() {
|
|
config := apg.NewConfig(apg.WithAlgorithm(apg.AlgoRandom),
|
|
apg.WithModeMask(apg.ModeSpecial|apg.ModeNumeric|apg.ModeLowerCase|apg.ModeUpperCase),
|
|
apg.WithFixedLength(15))
|
|
generator := apg.New(config)
|
|
password, err := generator.Generate()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
fmt.Println("Your password:", password)
|
|
}
|