-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsha-256_Hash_Generator
More file actions
59 lines (44 loc) · 1.61 KB
/
sha-256_Hash_Generator
File metadata and controls
59 lines (44 loc) · 1.61 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
import hashlib
import pyfiglet
import time
# Pyfiglet Banner
ascii_banner = pyfiglet.figlet_format("SHA-256 Hash Generator", font = "slant")
print(ascii_banner)
print("This tool is for SHA-256 hashes only.")
# User input choice and exceptions
while True:
hash_choice = str(input('Encode Hash or Decode Hash? Type E or D: ')).upper()
if hash_choice == 'D':
wordlist_location = str(input('Enter wordlist path: '))
hash_input = str(input('Enter hash: '))
time.sleep(1)
print("Cracking...")
time.sleep(2)
print("Wordlist: ", wordlist_location)
time.sleep(2)
print("Target Hash: ", hash_input)
time.sleep(2)
print("Almost done...")
time.sleep(2)
try:
with open(wordlist_location, 'r', encoding="utf-8", errors="ignore") as file:
for line in file.readlines():
hash_ob = hashlib.sha256(line.strip().encode())
hashed_pass = hash_ob.hexdigest()
if hashed_pass == hash_input:
print('Found Password --> ' + line.strip())
break
else:
print("Password not found")
continue
except FileNotFoundError:
print("Check file path or SHA256 hash")
except PermissionError:
print("Permission was denied.")
elif hash_choice == 'E':
user_hash = str(input('Enter text: '))
hash_ob = hashlib.sha256(user_hash.encode())
print(hash_ob.hexdigest())
else:
print("Invalid Choice")
break