mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-22 05:40:51 +01:00
Winni Neessen
fefb2557fc
The spelling of "Pronounceable" has been adjusted throughout the code. Moreover, a new functionality for producing pronounceable passwords spelled as correlating syllables has been integrated. This includes relevant changes to password character sets used for pronounceable passwords and enhancements to test this new feature.
34 lines
863 B
Go
34 lines
863 B
Go
package apg
|
|
|
|
// Algorithm is a type wrapper for an int type to represent different
|
|
// password generation algorithm
|
|
type Algorithm int
|
|
|
|
const (
|
|
// AlgoPronounceable represents the algorithm for pronounceable passwords
|
|
// (koremutake syllables)
|
|
AlgoPronounceable Algorithm = iota
|
|
// AlgoRandom represents the algorithm for purely random passwords according
|
|
// to the provided password modes/flags
|
|
AlgoRandom
|
|
// AlgoCoinFlip represents a very simple coinflip algorithm returning "heads"
|
|
// or "tails"
|
|
AlgoCoinFlip
|
|
// AlgoUnsupported represents an unsupported algorithm
|
|
AlgoUnsupported
|
|
)
|
|
|
|
// IntToAlgo takes an int value as input and returns the corresponding
|
|
// Algorithm
|
|
func IntToAlgo(a int) Algorithm {
|
|
switch a {
|
|
case 0:
|
|
return AlgoPronounceable
|
|
case 1:
|
|
return AlgoRandom
|
|
case 2:
|
|
return AlgoCoinFlip
|
|
default:
|
|
return AlgoUnsupported
|
|
}
|
|
}
|