Skip to content

Commit

Permalink
effort reduced
Browse files Browse the repository at this point in the history
  • Loading branch information
pranav1812 committed Jun 5, 2020
1 parent 5e1f08f commit ec9f958
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"git.ignoreLimitWarning": true
}
7 changes: 5 additions & 2 deletions projectFile2.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os, random
from hashlib import md5

keys=['this', 'was', 'the', 'correct', 'key', 'but', 'the', 'correct', 'order', 'can', 'be', 'different',
'so', 'better', 'try', 'a', 'bruteforce']
answer= "you are doing great but take care of the order"
hashval= md5(answer.encode()).hexdigest()
print(hashval)
keys=answer.split()

selected_folders=[]
for i in range(len(keys)):
Expand Down
10 changes: 6 additions & 4 deletions solution.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
from itertools import permutations

startTime=time.time()
toMatch='611d6663e938213f9643144650180a8d'
answer= "you are doing great but take care of the order"
toMatch= hashlib.md5(answer.encode()).hexdigest()


toCheck="here's one key :"

Expand All @@ -20,20 +22,20 @@
os.chdir('..')


print(len(found))
print(found)
matched= False
count =0
for perm in permutations(found):
permStr= ' '.join(perm)
permHash= hashlib.md5(permStr.encode()).hexdigest()

if toMatch==permHash:
if toMatch==permHash or permStr=="":
print('matched answer: '+permStr)
matched= True
break
else:
count+=1
print(count,'perms checked')
# print(count,'perms checked')


if not matched:
Expand Down

0 comments on commit ec9f958

Please sign in to comment.