Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect password created when using "false" for parameters #2

Open
suszi88 opened this issue Apr 9, 2020 · 1 comment
Open

Incorrect password created when using "false" for parameters #2

suszi88 opened this issue Apr 9, 2020 · 1 comment

Comments

@suszi88
Copy link

suszi88 commented Apr 9, 2020

Hi.
First, thanks for sharing your solution:)
I was looking into your Generate method. I have suggestion for improvement if you want.
All your parameters are marked with word "require" so from this perspective it's working correctly. Let me explain what I have in mind.
So if you would want to use those parameter as condition to include or not include specific chars (like I want password without digits) than "for" loop will return wrong password for you.
In line:
string rcs = randomChars[rand.Next(0, randomChars.Length)];
you are going back to randomChars which contains all chars(including in this sample digits).
If you would like to improve your method than I would suggest to add additional property which will held only chars filtered by you parameters and then use this property to populates rcs.
This way you will be able to produce password with "required" chars and password which will not have specific chars on your wish.
Cheers

@peterbozso
Copy link

peterbozso commented Jan 2, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants