Building A Password Generator in 3 Minutes

Today—the whole week really—has been consumed by yak shaving so this is a short offering. Salah Qadri has a nice 3 minute video (3 minutes, 48 secs actually) in which he builds a reasonably good password generator.

The generator builds a password from upper/lower case letters, numbers, and symbols. The type of character and which one it is used are chosen randomly at each step using the Python random.choice method. One can argue that Qadri should have used the secrets.choice method instead but for occasional one-off passwords random.choice is probably adequate.

My only other nit is that I would have used a more functional approach rather than relying on globals but that’s more a personal preference. If you want to generate random passwords, Qadri’s video has some nice ideas. I like the way he handled choosing a type of character randomly. The code is easy to follow even if you aren’t a Python coder.

This entry was posted in General and tagged , . Bookmark the permalink.