-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhasher.py
128 lines (126 loc) · 4.3 KB
/
hasher.py
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import sys
import os
import hashlib
import string
logo = '''
888
888
888
.d88888 .d88b. 888 888 8888b. 88888b. .d88b. 88888b.d88b. .d88b.
d88" 888 d8P Y8b 888 888 "88b 888 "88b d8P Y8b 888 "888 "88b d88""88b
888 888 88888888 888 888 .d888888 888 888 88888888 888 888 888 888 888
Y88b 888 Y8b. Y88b 888 888 888 888 888 Y8b. 888 888 888 Y88..88P
"Y88888 "Y8888 "Y88888 "Y888888 888 888 "Y8888 888 888 888 "Y88P"
888
Y8b d88P
"Y88P"
File Hasher 1.0v
ALL RIGHTS RESEVED To
DEYANEMO 2017(C)
'''
print(logo)
done = '''
`7MM"""Yb. .g8""8q. `7MN. `7MF'`7MM"""YMM OO
MM `Yb. .dP' `YM. MMN. M MM `7 88
MM `Mb dM' `MM M YMb M MM d ||
MM MM MM MM M `MN. M MMmmMM ||
MM ,MP MM. ,MP M `MM.M MM Y , `'
MM ,dP' `Mb. ,dP' M YMM MM ,M ,,
.JMMmmmdP' `"bmmd"' .JML. YM .JMMmmmmMMM db
'''
def letsDoThis():
print(NotHashedFile)
print(DesHashedFile)
print("Methods : ")
print(" 1- MD5")
print(" 2- SHA1")
print(" 3- SHA224")
print(" 4- SHA256")
print(" 5- SHA384")
print(" 6- SHA512")
Methods = input("What Method To use : ")
Methods = int(Methods)
if Methods == 1 and NotHashedFile and DesHashedFile :
print("You choosed MD5")
file = open(NotHashedFile , "r+")
deyan = file.readlines()
file.close()
str1 = ''.join(deyan)
file2 = open(DesHashedFile ,"w+")
file2.write("#HashedWithMd5")
for line in str1:
md5 = hashlib.md5(line.encode("utf")).hexdigest()
print(md5)
file2.write(md5)
print(done)
elif Methods ==2 and NotHashedFile and DesHashedFile:
print("You choosed SHA1")
file = open(NotHashedFile , "r+")
deyan = file.readlines()
file.close()
str1 = ''.join(deyan)
file2 = open(DesHashedFile ,"w+")
file2.write("#HashedWithSHA1")
for line in str1:
md5 = hashlib.sha1(line.encode("utf")).hexdigest()
print(md5)
file2.write(md5)
print(done)
elif Methods ==3 and NotHashedFile and DesHashedFile:
print("You choosed SHA224")
file = open(NotHashedFile , "r+")
deyan = file.readlines()
file.close()
str1 = ''.join(deyan)
file2 = open(DesHashedFile ,"w+")
file2.write("#HashedWithSHA224")
for line in str1:
md5 = hashlib.sha224(line.encode("utf")).hexdigest()
print(md5)
file2.write(md5)
print(done)
elif Methods ==4 and NotHashedFile and DesHashedFile:
print("You choosed SHA256")
file = open(NotHashedFile , "r+")
deyan = file.readlines()
file.close()
str1 = ''.join(deyan)
file2 = open(DesHashedFile ,"w+")
file2.write("#HashedWithSHA384")
for line in str1:
md5 = hashlib.sha256(line.encode("utf")).hexdigest()
print(md5)
file2.write(md5)
print(done)
elif Methods ==5 and NotHashedFile and DesHashedFile:
print("You choosed SHA384")
file = open(NotHashedFile , "r+")
deyan = file.readlines()
file.close()
str1 = ''.join(deyan)
file2 = open(DesHashedFile ,"w+")
file2.write("#HashedWithSHA384")
for line in str1:
md5 = hashlib.sha384(line.encode("utf")).hexdigest()
print(md5)
file2.write(md5)
print(done)
elif Methods ==6 and NotHashedFile and DesHashedFile:
print("You choosed SHA512")
file = open(NotHashedFile , "r+")
deyan = file.readlines()
file.close()
str1 = ''.join(deyan)
file2 = open(DesHashedFile ,"w+")
file2.write("#HashedWithSHA512")
for line in str1:
md5 = hashlib.sha512(line.encode("utf")).hexdigest()
print(md5)
file2.write(md5)
print(done)
else:
print("Please Choose From The list above ^")
print("Please Enter a File To Hash And a Destination")
NotHashedFile = input("File Name To Hash : ")
DesHashedFile = input("Hashed File Destination : ")
letsDoThis()