How to quickly check if given password is strong enough
Recently i needed to quickly check that password is strong enough in accordance with customer requirements :
- Passwords will contain at least (1) upper case letter
- Passwords will contain at least (1) lower case letter
- Passwords will contain at least (1) number or special character
- Passwords will contain at least (10) characters in length
- Password maximum length is 64
Here's what i got with python :
import re
# Passwords will contain at least (1) upper case letter
# Passwords will contain at least (1) lower case letter
# Passwords will contain at least (1) number or special character
# Passwords will contain at least (8) characters in length
# Password maximum length is not limited
def test_password(password):
return re.match(r'?=^.{10,64}$)((?=.*\d)|(?=.*\W+))
(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*