mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-22 13:50:49 +01:00
30 lines
684 B
Go
30 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
|
||
|
}
|
||
|
}
|