before adding cryptoshuffler

This commit is contained in:
2022-03-03 05:51:22 -05:00
parent 480dcd7e24
commit 77d5271b5a
5 changed files with 116 additions and 23 deletions

View File

@@ -71,14 +71,23 @@ func (o *GenOpts) generatePassword(c CharSet) (password string, err error) {
// And make the rune slice of that length.
passAlloc = make([]rune, passLen)
for _, idx := range passAlloc {
for idx, _ := range passAlloc {
var char Char
if char, err = c.RandChar(); err != nil {
return
}
for {
var isDisabled bool
passAlloc[idx] = rune(char)
if char, err = c.RandChar(); err != nil {
return
}
if isDisabled, err = o.DisabledChars.Has(char); err != nil || isDisabled {
err = nil
continue
}
passAlloc[idx] = rune(char)
break
}
}
password = string(passAlloc)