Skip to content

Instantly share code, notes, and snippets.

@shunkp
Created March 15, 2015 05:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shunkp/ecf358aba90e7cd2fbba to your computer and use it in GitHub Desktop.
Save shunkp/ecf358aba90e7cd2fbba to your computer and use it in GitHub Desktop.
from hashlib import sha1
import itertools
import time
chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
match = 'ff7b948953ac'
i = 1
start = time.time()
while True:
gen = itertools.combinations_with_replacement(chars,i)
for password in gen:
tmp = ''.join(password).encode('utf-8')
if sha1(tmp).hexdigest()[:12] == match:
print('Match: {0}\n'.format(tmp))
break
print('{0} done ({1})'.format(i,str(time.time() - start)))
start = time.time()
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment