top of page
![](https://static.wixstatic.com/media/6d8832_4621656d1cf64202a703bffc935585f5~mv2.jpg/v1/fill/w_980,h_653,al_c,q_85,usm_0.66_1.00_0.01,enc_avif,quality_auto/building.jpg)
Ever wondered if your password is strong enough? Consider this password strength checker written in python!
Jan 3
1 min read
0
9
0
![](https://static.wixstatic.com/media/4c387e_0e02aece826c4330bed20ca95ab179d3~mv2.jpg/v1/fill/w_147,h_147,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/4c387e_0e02aece826c4330bed20ca95ab179d3~mv2.jpg)
Consider the password: terry
Seems weak, but how do we know?
Running the code at the bottom of the page - if we input the term terry we get the following back from python:
![](https://static.wixstatic.com/media/4c387e_809e03d030404776b16dd7702c218011~mv2.png/v1/fill/w_63,h_11,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4c387e_809e03d030404776b16dd7702c218011~mv2.png)
If we try tErry - we get:
![](https://static.wixstatic.com/media/4c387e_14e3e1d1b1ca4d9399fe3092bae9821e~mv2.png/v1/fill/w_64,h_11,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4c387e_14e3e1d1b1ca4d9399fe3092bae9821e~mv2.png)
if we try tE9rry - we get:
![](https://static.wixstatic.com/media/4c387e_eb21535e856c4bdeb831f47edda64e33~mv2.png/v1/fill/w_65,h_10,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4c387e_eb21535e856c4bdeb831f47edda64e33~mv2.png)
And finally if we try tE9rry^ - we get:
![](https://static.wixstatic.com/media/4c387e_ce0c5862e09e42f883c3ec2e19a63640~mv2.png/v1/fill/w_67,h_10,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4c387e_ce0c5862e09e42f883c3ec2e19a63640~mv2.png)
Python is using the re library to search initially for lower case letters, then upper case letters, then numbers and finally special characters. If it finds the requisite search item a 1 is returned instead of a zero and the 1s are added together to generate a score from 0-4. An elif statement then just translates the numerical information into something meaningful for the user.
![](https://static.wixstatic.com/media/4c387e_6a752ea520c14c14b6894691883b7f38~mv2.png/v1/fill/w_57,h_82,al_c,q_85,usm_0.66_1.00_0.01,blur_2,enc_auto/4c387e_6a752ea520c14c14b6894691883b7f38~mv2.png)
Related Posts
Comments
Share Your ThoughtsBe the first to write a comment.
bottom of page