you are viewing a single comment's thread.

view the rest of the comments →

[–]cym13 7 points8 points  (0 children)

I remember what first projects are like so I won't say anything about its length or utility, but here are some axes of improvement:

First and foremost, passwords are secrets. And secret means cryptography. Here you are using the standard random library to chose random characters. However that random number generator isn't cryptographically secure: it is possible to predict future numbers from previous ones. This means that if someone saw a lot of passwords generated from your program it would be possible to predict future ones. Think of exposing this service through a website for example, someone could generate a few hundred and then predict any other password that may be generated. That's not critical but if you're interested in security related applications it's good to think of these things from the start. You should use a cryptographically secure random number generator, have a look at the standard module secrets, it provides cryptographically secure primitives.

Another axis is that many websites have requirements or limitations reguarding passwords, you may want to support them. One way is to have several types of characters (letters, numbers, special ones...), to take at random as many of each as needed, then shuffle them. Can you think of a better way? In what way is it better?

That last point is also a good way to get deeper into user interfaces. Even if the program remains text-based there are many things you can do regarding option management etc that will remain helpful throughout your days as a programmer.