You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.2 KiB
50 lines
1.2 KiB
def main():
|
|
passwordCrypte = "azerty"
|
|
tabPass =list("a")
|
|
print("test",2*2)
|
|
found, passTrouve = testPass(True,0,tabPass,passwordCrypte )
|
|
if found == True :
|
|
print("Trouvé ! : " + passTrouve)
|
|
|
|
tabChar = list("abcdefghijklmnopqrstuvwxyz")
|
|
|
|
|
|
def testPass(isFirst, pos, tabPass, password ):
|
|
found = False
|
|
passTrouve = ""
|
|
|
|
for char in tabChar:
|
|
tabPass[pos] = char
|
|
if "".join(tabPass) == password:
|
|
found=True
|
|
passTrouve = "".join(tabPass)
|
|
return found, passTrouve
|
|
else:
|
|
print("".join(tabPass) + "\t | " + str(len(tabPass)))
|
|
|
|
|
|
if isFirst == True and found == False:
|
|
while found != True :
|
|
tabPass = tabPass + list('a')
|
|
found,passTrouve =testPass(False,len(tabPass)-1 , tabPass,password)
|
|
if found == True :
|
|
found=True
|
|
passTrouve = "".join(tabPass)
|
|
return found, passTrouve
|
|
|
|
|
|
if pos > 0 and found == False:
|
|
for char in tabChar :
|
|
tabPass[pos] = char
|
|
found, passTrouve =testPass(False,pos-1, tabPass,password)
|
|
if found == True :
|
|
found=True
|
|
passTrouve = "".join(tabPass)
|
|
return found, passTrouve
|
|
passTrouve = "".join(tabPass)
|
|
return found , passTrouve
|
|
|
|
|
|
|
|
if __name__ == '__main__' :
|
|
main() |