Created
September 16, 2020 13:49
-
-
Save evd0kim/5f95febe841bcfa856f92c6889d49c85 to your computer and use it in GitHub Desktop.
Password strength
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#python | |
from math import log | |
fact = lambda n: n*fact(n-1) if n > 1 else 1 | |
print("MEDIUM: length == 8 && sawUpper && sawLower && sawDigit") | |
length = 8 | |
symbols = 26 + 26 + 10 | |
key_space = fact(symbols)/fact(symbols - length) | |
print(f"\tkeyspace exponent: {log(key_space, 2)}") | |
print("GOOD: length > 8 && sawUpper && sawLower && sawDigit") | |
length = 9 | |
symbols = 26 + 26 + 10 | |
key_space = fact(symbols)/fact(symbols - length) | |
print(f"\tkeyspace exponent(length == {length}): {log(key_space, 2)}") | |
print("MEDIUM: length == 10 && sawUpper && sawLower") | |
length = 10 | |
symbols = 26 + 26 | |
key_space = fact(symbols)/fact(symbols - length) | |
print(f"\tkeyspace exponent: {log(key_space, 2)}") | |
print("GOOD: length > 10 && sawUpper && sawLower") | |
length = 11 | |
symbols = 26 + 26 | |
key_space = fact(symbols)/fact(symbols - length) | |
print(f"\tkeyspace exponent(length == {length}): {log(key_space, 2)}") | |
print("MEDIUM: length == 12 && sawUpper || sawLower") | |
length = 12 | |
symbols = 26 | |
key_space = fact(symbols)/fact(symbols - length) | |
print(f"\tkeyspace exponent: {log(key_space, 2)}") | |
print("GOOD: length > 12 && sawUpper || sawLower") | |
length = 13 | |
symbols = 26 | |
key_space = fact(symbols)/fact(symbols - length) | |
print(f"\tkeyspace exponent(lower bound): {log(key_space, 2)}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment