-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSHA1-Final.py
More file actions
45 lines (29 loc) · 946 Bytes
/
SHA1-Final.py
File metadata and controls
45 lines (29 loc) · 946 Bytes
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
import random, string
import hashlib
inputString = ''.join(random.choice(string.ascii_uppercase) for i in range(4))
inputString = "DAN"
hash_object = hashlib.sha1(inputString)
hex_dig = hash_object.hexdigest()
length = len(inputString)
myWordHash = hex_dig[:5]
print "My word is ", inputString
print "My word hashed is ", myWordHash
myList = []
void = []
i = 0
randomWordHash = ""
wordGenerate = ""
while (myWordHash != randomWordHash):
if (wordGenerate == inputString):
wordGenerate = ''.join(random.choice(string.ascii_uppercase) for i in range(3))
inputs = wordGenerate
hash_object = hashlib.sha1(inputs)
hex_dig = hash_object.hexdigest()
#length = len(inputString)
randomWordHash = hex_dig[:5]
print wordGenerate
else:
print wordGenerate
# '2591e5f46'
print inputString + " is equal to " + inputs
print "Fin"