The average person in the US spends over 8 hours online per day. A lot of that time is spent on secure sites that require a password. Email, bank accounts, social media and so on. Four out of five breaches are somehow linked to passwords. A study by Verizon, concerning breaches involving hacking, states that 80% of breaches are caused by passwords. What many people don’t realize is how easy it is for a bad actor to crack a short, simple password. I know plenty of people that will create a password using known/ easily researchable things ie family members names, birthdates, phone numbers and so on.
The NIST National Institute of Standards and Technology, has 3 password guidelines for creating a secure password, long length, complex and random. The combination of those three will help prevent yourself from getting hacked. Below I have provided an image just to show how easy it can be for a bad actor to brute force your account and the length it will take with a good complex password.
![](https://static1.squarespace.com/static/5ffe234606e5ec7bfc57a7a3/t/643deedde5029f00d8107749/1681780449224/2023+Password+Table_Rectangular.jpg?format=1500w)
In organizations I worked for in the past the recommendation was 12 characters, this year that was upped to 14 which is also recommended by the NIST. If you’re like me then coming up with a complex 14 long password is no easy feat but luckily for us we have the convenience of programming to help us generate a complex password.
Writing all of this up took 10 minutes and as I am a python novice, it shouldn’t take you anymore as well. This simple script will provide you with a randomly generated password that fits the criteria for security, long length, complex and random.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-06-at-3.01.21-PM-1024x581.png)
This first line is the random function. This is a library of functions that is built into python and extends the basic features of python. Sometimes we may want the computer to pick a random number, letter, symbol in a given range and the Random Module provides access that supports this.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-06-at-3.12.08-PM.png)
These next lines create a bunch of strings that contain all possible characters we will use for our password generator.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-06-at-3.22.15-PM.png)
Next we’re going to create a boolean for all the things we want to include in the password. Boolean is one of Pythons built in data types that is used to express the truth value of an expression. You can change the trues to false later if you’d like but for now I’m setting everything as true. Upper for uppercase, lower for lowercase and so on.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-06-at-3.30.17-PM.png)
Now the next thing we need to do is create a string containing all the things that we’re going to use. This will tie our strings in.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-07-at-11.56.53-AM.png)
Next we will set the length of the password, and how many passwords we will want generated at once. Im going with the NIST recommended 14 characters as this is a showcase on secure passwords.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-07-at-11.59.15-AM.png)
So now that we’ve doin that we’ll be writing our next string using the Python Join function which joins elements and returns the combined string. The “all” will grab all the characters we’re using and the “length” will determine the amount of characters to be used. The “Print()” function will return the specified passwords .
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-07-at-12.06.28-PM.png)
Now once done, you can run this command and it should return passwords for your use.
![](https://blaketechportfolio.com/wp-content/uploads/2023/06/Screenshot-2023-06-07-at-12.07.45-PM.png)