Skip to content

Instantly share code, notes, and snippets.

@harieamjari
Created May 4, 2019 11:02
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 harieamjari/56cca2d2c7ba8ecdf3b23b3ed2b456e5 to your computer and use it in GitHub Desktop.
Save harieamjari/56cca2d2c7ba8ecdf3b23b3ed2b456e5 to your computer and use it in GitHub Desktop.
A python script that tries to crack hash
import hashlib
import string
import sys
hash_name = 'd5787cd36cdf96b5ff9edcfb2461e092a9cbe6e0e15474464346950a5c6b5616'
# random_list = ['a', 'b', 'c', 'd']
random_list = list(string.ascii_lowercase)
length = len(random_list)
lens = 0
print("\nSHA-256")
while lens < length:
print("\n", lens, random_list[lens])
for i in random_list:
word = random_list[lens] + i
hash = hashlib.sha256(word.encode('utf-8')).hexdigest()
if hash == hash_name:
print(word, '--> match found! ', hash)
sys.exit()
else:
print(word, '--> no match')
lens += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment