# π€ Generating a Password XKCD StyleΒΆ

Nobody likes to change their password, and its always hard trying to come up with a new password. In this lab weβll solve that problem using a solution posed by the popular XKCD comic.

Lets start by creating a traditional random password composed of numbers, letters, and a few special characters.

Next you follow the XKCD model of selecting four random words and concatenating them together to for our password.

Challenge

This last part goes beyond what you have covered in the book so far, but Iβll give you the extra code you need. You will probably be able to figure out what it does and this is kind of a fun preview of things to come.

Lets suppose you DO have a 4 character password composed only of lower case letters. How many guesses would it take you to guess the password? You can actually write a program to create a four character string and compare it to the known password. If we put this process inside a loop we can keep track and see how many guesses it takes us to find the matching password.

You will see that the number of guesses can vary pretty widely. from less than 10,000 to over 500,000! What happens if you increase the length to 5 characters? Or what happens if you allow your four character password to include numbers or upper case letters? all of these changes definitely increase the complexity of the password and therefore the number of tries. Each of these changes increases the number of possible passwords. Can you calculate the number of possible four letter passwords using just the 26 letters of the alphabet and 4 letters in the password? How does that change if you allow 26 letters plus 10 digits? Now what if you have an 8 character password?

My MacBook Pro averages around 16,300 guesses per second. If you assume that you will on average have to try about 1/2 of the possible combinations, how long will it take to crack an 8 letter password with upper case letters, lower case letters, and 10 possible digits?

Post Project Questions

During this project I was primarily in my...
• Comfort Zone
• Learning Zone
• Panic Zone
Completing this project took...
• Very little time
• A reasonable amount of time
• More time than is reasonable
Based on my own interests and needs, the things taught in this project...
• Don't seem worth learning
• May be worth learning
• Are definitely worth learning
For me to master the things taught in this project feels...
• Definitely within reach
• Within reach if I try my hardest
• Out of reach no matter how hard I try