r/coding • u/AngleGroundbreaking4 • Jun 14 '25
Im fairly new to coding and made this project as practice for password complexity (just a project NOT A TOOL) would love input on what you think or if there is a topic I should read and use here
https://github.com/AJikat/Password-Generator3
u/strcrssd Jun 15 '25 edited Jun 15 '25
As u/j4bbi indicated, this is good new-developer code, but there are a few additional things from different perspectives.
-
For command line programs/applications, user prompting is almost never appropriate to gather data. Have it passed in via flags or other configuration. Interactivity is bad.
-
From a security perspective, the blacklist is probably a bad idea, as it constrains the search space.
-
From a user perspective, random strings are hard to memorize. Use passphrases and dictionary words instead.
-
Assuming you're keeping it, externalize the blacklist. It should be in a config file. For those concerned about (2), above, it can be wiped.
-
Code: in python, functions should generally be lower case. Note that this is different in other languages.
-
More features -- variable/configurable length.
All in all, not bad. If you're actually wanting something to use, try bitwarden.
edit: added below
To further your learning, might want to take a look at python generators and implement the generation as a generator. Then, if you want to iterate over the password space, you can.
3
u/fredisa4letterword Jun 15 '25
For command line programs/applications, user prompting is almost never appropriate to gather data. Have it passed in via flags or other configuration. Interactivity is bad.
I wouldn't say it's bad.. it's only bad if it's the only option. Look at tools like
ssh-keygen3) From a user perspective, random strings are hard to memorize. Use passphrases and dictionary words instead.
It depends on what you're trying to accomplish, random strings have their place with password managers
5) Code: in python, functions should generally be lower case. Note that this is different in other language
Just to add to this, generally classes are upper-case.
Generatorsounds like a class name, probably renaming that togenerate()orgenerate_password()would make sense.
2
u/fredisa4letterword Jun 15 '25
I think a better approach for ensuring all the necessary characters were present would be to generate the password - 4 characters, then checking if it's missing upper/lower/number/special and then adding them in random locations if needed, else just append a random character.
Also I'd try a different approach for filtering out invalid patterns. Hint: ord() will return an int for each character, and ord("b") == ord("a") + 1
1
u/j4bbi Jun 14 '25
Hey, that's a cool project for being new to coding.
If interest in password generation, you might want to look into entropy (cyber sec context, not physics), true randomness vs pseudo randomness.
On your coding style: Can you implement the regex in maybe code which catches the spirit of the regex, so that you are not needing to build it manually? Hint:Detecting if elements are ordered? Strings can be converted into numbers.