Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python password checker

#If you are asking for "validity of  new password",

# Python program to check validation of password
# Module of regular expression is used with search()
import re
password = "R@m@_f0rtu9e$"
flag = 0
while True:  
    if (len(password)<8):
        flag = -1
        break
    elif not re.search("[a-z]", password):
        flag = -1
        break
    elif not re.search("[A-Z]", password):
        flag = -1
        break
    elif not re.search("[0-9]", password):
        flag = -1
        break
    elif not re.search("[_@$]", password):
        flag = -1
        break
    elif re.search("s", password):
        flag = -1
        break
    else:
        flag = 0
        print("Valid Password")
        break
  
if flag ==-1:
    print("Not a Valid Password")
    
    
#if you want to check an inputted password if it matches a predetermined password,

word = 'welovegrepper'

def check_password(input):
    if input == word:
        print("granted")
    else:
        print("denied")
        
while True:
    print("type password")
    cmd = input()
    check_password(cmd)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #python #password #checker
ADD COMMENT
Topic
Name
8+2 =