Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsimple.py
More file actions
Latest commit
50 lines (40 loc) · 1.18 KB
/
Copy pathsimple.py
File metadata and controls
50 lines (40 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
importtime
testChars="abcdefghijklmnopqrstuvwxyz"
#testChars = "0987654321"
#testChars = "abcdefghijklmnopqrstuvwxyz0987654321"
defcheckPwForLen(pwLen):
globalprintCount
generatedPw= [testChars[0]] *pwLen
whilegeneratedPw!= [testChars[-1]] *pwLen:
incrementPw(generatedPw)
printCount+=1
ifprintCount%10000==0:
print('TESTING:', generatedPw)
ifgeneratedPw==pwList:
print('TESTING:', generatedPw)
print('FOUND:', ''.join(generatedPw))
returnTrue
returnFalse
defincrementPw(generatedPw):
incr=0
whileTrue:
pos=testChars.find(generatedPw[incr])
ifpos==len(testChars)-1:
generatedPw[incr] =testChars[0]
incr+=1
ifincr>len(generatedPw)-1:
break
else:
generatedPw[incr] =testChars[pos+1]
break
userPw=input("Enter Password: ")
pwList=list(userPw)
maxPwLen=len(pwList)
printCount=0
start=time.time()
foriinrange(maxPwLen):
ifcheckPwForLen(i+1):
break
stop=time.time()
print('DURATION:', stop-start)
print('CHECKED:', printCount)