Run this Kotlin code to evaluate the strength of your password based on the following criteria:
- length
- the number of special characters
- whether it contains upper case letters, lower case letters and numbers
- whether it is (or it contains) a common pattern, such as "qwerty", "123123", "abcdef", etc.
A string containing a password.
Example:
ADmINadmin3456$SSss
Password length: 19
[x] Digits
[x] Upper case letters
[x] Lower case letters
[x] 1 special character(s)
[!] Common pattern 'ADmIN' found
[!] Common pattern 'admin' found
[!] Common pattern 'SSss' found
[!] Common pattern '3456' found
TOTAL SCORE: 2 (very weak)
The following password patterns are taken into account:
Pattern description | Examples |
---|---|
Arithmetic sequences with common differences of 1 or -1 | 1234 65432 |
Sequences of letters in (reverse) alphabetical order | abcd dcba hIjkLmN |
Sequences of repeating characters | GGGG _____ 6666 AAAAaa |
Sequence of repeating pairs of characters | 121212 HAHa *+*+*+ |
Common password patterns | qwerty admin PassWorD |
Only sequences longer than 3 characters are detected. No search algorithm is not case-sensitive.
Score | Password Strength |
---|---|
< 3 | very weak |
3 - 4 | weak |
5 - 6 | medium |
7 - 8 | strong |
> 8 | very strong |
Total score is calculated based on the following rules:
+1 point for every 8 characters (password length)
+1 point for numbers
+1 point for upper case letters
+1 point for lower case letters
+1 point for every special character (characters that are not letters or digits)
-1 point for every common pattern