Calculating password strength
A lot of websites display the strength of the password chosen by the user on their registration forms. The goal of this practice is to help the user choose a better, stronger password which cannot be guessed or brute-forced easily.
In this recipe, we're going to make a password strength calculator. It will determine the password strength by calculating the number of brute-force attempts that a potential attacker must make before guessing the password. It will also warn the user if his password is in a list of 500 commonly used passwords.
Getting ready
Before we begin, its important to look at how we're going to calculate the number of brute-force attempts that an attacker must make. We're going to take a look at two factors: the length of the password and the size of the character set used by the user.
The size of the character set can be determined as follows:
If the user adds a lowercase alphabet letter in his password, the size of the character set grows by 26...