apg-go/algo.go
Winni Neessen ac97b94ec9
Refactor generator and add config options
Refactored the generator to include a new config option, changed function signatures to follow the new structure, and renamed the function 'RandomString' to 'RandomStringFromCharRange' for clarity. Also, added a new mode and algorithm feature to enhance password generation. Furthermore, added several tests for new features and configurations. Adapted the CLI to use the new configuration approach. This refactoring was necessary to improve the customizability and clarity of the password generation process. Fixed minor issues and added '.gitignore' for clean commits in the future.
2023-08-04 16:02:58 +02:00

29 lines
684 B
Go

package apg
// Algorithm is a type wrapper for an int type to represent different
// password generation algorithm
type Algorithm int
const (
// Pronouncable represents the algorithm for pronouncable passwords
// (koremutake syllables)
Pronouncable Algorithm = iota
// Random represents the algorithm for purely random passwords according
// to the provided password modes/flags
Random
// Unsupported represents an unsupported algorithm
Unsupported
)
// IntToAlgo takes an int value as input and returns the corresponding
// Algorithm
func IntToAlgo(a int) Algorithm {
switch a {
case 0:
return Pronouncable
case 1:
return Random
default:
return Unsupported
}
}