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

Fix an old bug and add options to include and enforce additional characters #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stefanct
Copy link

Hi,
I got annoyed by the need to include at least one symbol character in passwords but didn't want to use just any symbol but specifically _ because it gets included in double-click selections in my terminal. So I added two options... one simply allows the user to supply a string of characters that should get included in the pool of valid characters (i.e. kind of the reverse of --remove-chars). The other one does not only add the characters but also tests if they are included in the resulting password. The latter dramatically increases the runtime up to infinity if conflicting settings are chosen but it does not tinker with the randomness whatsoever (which I think is more important).
I have split the enforcement patch into two: The first does only check if any of the given characters is included at least once in every resulting password. The second one changes that to test that all of the characters are included at least once, which is far less likely to happen at random thus increases the runtime a lot more (exponentially in the length of the string AFAICS) but is likely more useful to potential users.

I have not put much thought into refactoring anything (e.g., the prototypes get a bit bloated) but I don't think there is too much to gain.

The patches do not include changes to the manpage yet. I'd like to have some feedback first.
Cheers.

PS: find_chars could simply be replaced with strpbrk AFAICT.

At least one character of the given string has to be present in each
resulting password.
Every additionally forced character increases the runtime exponentially.
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

Successfully merging this pull request may close these issues.

1 participant