generated from VLADIMIR/template
clear
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
package password
|
||||
|
||||
type IPasswordGenerator interface {
|
||||
GeneratePassword(length int) string
|
||||
}
|
||||
@@ -6,8 +6,14 @@ var (
|
||||
letters = []rune("abcdefghijklmnopqrstuvwxyz123456789")
|
||||
)
|
||||
|
||||
func GenPass(n int) string {
|
||||
b := make([]rune, n)
|
||||
type service struct{}
|
||||
|
||||
func NewPasswordGenerator() IPasswordGenerator {
|
||||
return &service{}
|
||||
}
|
||||
|
||||
func (s *service) GeneratePassword(length int) string {
|
||||
b := make([]rune, length)
|
||||
for i := range b {
|
||||
b[i] = letters[rand.Intn(len(letters))]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user