People have been trying to determine a metric for password security for a long time. One relatively outdated way to determine this is using Password Entropy.
This is the equation for Password Entropy.
Where E is the entropy, R is the pool, and L is the length of the password.
The pool is determined by what type of characters are in the password. For example, there are 26 lowercase characters, so a password containing only lowercase letters would have a pool of 26. There are 26 uppercase characters, so a password containing lower and uppercase characters would have a pool of 52.
After determining the entropy, the password is classified under 5 categories:
if E < 28, the password is Very Weak.
if 28 < E < 35, the password is Weak.
if 35 < E < 59, the password is Good.
if 59 < E < 127, the password is Strong.
if E > 127, the password is Very Strong.
Your task is to create a program that takes in a string of text and outputs the strength of the password.
The password should be able to contain upper and lowercase characters, digits, and these symbols:
> symbols = ['!', '@', '#', '$', '%', '&', '(', ')', '-', '_', '[', ']', '{', '}', ';', ':', '"', '.', '/', '<', '>', '?']
You may also have to use import math to gain access to the log function.Â
Example:
> Password: abc123
> Weak
Since the password contains only lowercase characters and digits, the pool will be 26 + 10 = 36. The password is 6 characters long. Inputting that into the formula outputs around 31.01 bits of entropy, making this password Weak.
Your program should output the following. Be sure to do your own testing.
> Password: algebruh2
> Good
> Password: Mr.Lee1$th3g0@t!
> Strong
> Password: heyYall!
> Good
> Password: abc123
> Weak
> Password: foo
> Very Weak
> Password: totallyNotmyPW
> Strong
> Password: this!s@V3rYStrongPWisntthatcrazy?
> Very Strong
> Password: isn'tvalid
> Invalid Password
> Password: chickenS
> Good
> Password: thankU4Agr8Ye@r
> Strong
Save your program as "lastname_password.py" and upload this alongside your other two programs onto Google Classroom.