-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpyhases.py
133 lines (109 loc) · 3.15 KB
/
pyhases.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
129
130
131
132
133
# Import Module
import hashlib
# Colors
Blue = "\033[1;0;34m"
Green = "\033[1;92m"
White = "\033[1;97m"
def BannerFunction():
print(f"""{Blue}
---------------------------------------
| PyHasees v1.0 - Hash Generator |
---------------------------------------
Author : Md. Nur Habib
Programmer & Full Stack Developer.
GitHub : github.com/thenurhabib
Twitter : twitter.com/thenurhab1b
Facebook : facebook.com/thenurhab1b
HackerRank : hackerrank.com/thenurhabib
""")
# Hash Variabls.
hash1 = hashlib.md5()
hash2 = hashlib.sha1()
hash3 = hashlib.sha224()
hash4 = hashlib.sha256()
hash5 = hashlib.sha384()
hash6 = hashlib.sha3_224()
hash7 = hashlib.sha3_256()
hash8 = hashlib.sha3_384()
hash9 = hashlib.sha3_512()
hash10 = hashlib.sha512()
# Print banner
BannerFunction()
# Print Options
print(f""" {Green}
Select a number.
----------------
01. MD5
02. sha1
03. sha224
04. sha256
05. sha384
06. sha3_224
07. sha3_256
08. sha3_384
09. sha3_512
10. sha512
"""
)
# get Input From User
getanumber = input(f"{White}Select a Number : ")
password = input("Enter Your text : ")
# Password Hashing
hash1.update(password.encode("utf-8"))
hash2.update(password.encode("utf-8"))
hash3.update(password.encode("utf-8"))
hash4.update(password.encode("utf-8"))
hash5.update(password.encode("utf-8"))
hash6.update(password.encode("utf-8"))
hash7.update(password.encode("utf-8"))
hash8.update(password.encode("utf-8"))
hash9.update(password.encode("utf-8"))
hash10.update(password.encode("utf-8"))
# Hashes
md5 = f"MD5 Encryption : {hash1.hexdigest()}"
sha1 = f"sha1 Encryption : {hash2.hexdigest()}"
sha224 = f"sha224 Encryption : {hash3.hexdigest()}"
sha256 = f"sha256 Encryption : {hash4.hexdigest()}"
sha384 = f"sha384 Encryption : {hash5.hexdigest()}"
sha3_224 = f"sha3_224 Encryption : {hash6.hexdigest()}"
sha3_256 = f"sha3_256 Encryption : {hash7.hexdigest()}"
sha3_384 = f"sha3_384 Encryption : {hash8.hexdigest()}"
sha3_512 = f"sha3_512 Encryption : {hash9.hexdigest()}"
sha512 = f"sha512 Encryption : {hash10.hexdigest()}"
# Print Selected hash.
try:
while True:
if getanumber == "1" or "01":
print(md5)
break
if getanumber == "2" or "02":
print(sha1)
break
if getanumber == "3" or "03":
print(sha224)
break
if getanumber == "4" or "04":
print(sha256)
break
if getanumber == "5" or "05":
print(sha384)
break
if getanumber == "6" or "06":
print(sha3_224)
break
if getanumber == "7" or "07":
print(sha3_256)
break
if getanumber == "8" or "08":
print(sha3_384)
break
if getanumber == "9" or "09":
print(sha3_512)
break
if getanumber == "10":
print(sha512)
break
else:
print("Please Enter a Number Between 1 or 10.")
except Exception as err:
print(f"An Error Occund : {err}")