Add simple password generator code

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.
This commit is contained in:
Winni Neessen 2024-03-14 09:43:21 +01:00
parent cf47feecbb
commit 82b015d819
Signed by: wneessen
GPG key ID: 385AC9889632126E

View file

@ -0,0 +1,19 @@
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)
}