-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmike.py
41 lines (31 loc) · 959 Bytes
/
mike.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
# -*- coding: utf-8 -*-
"""Mike.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1-36U1bUc60FcPCCPoJyF9oSde9wemDH4
"""
import hashlib
import time
NONCE = 0
data = 'Michael'
start_time = time.time()
found = 0
attempts = 0
while found == 0:
z = str(data)+str(NONCE)
newHash = hashlib.sha256(z.encode()).hexdigest()
if newHash[:9] == '000000000':
found = 1
NONCE += 1
end_time = time.time()
# Driver Code
print(f'New Hash is: \t\t{newHash}')
print(f'NONCE is: \t\t{NONCE}')
print('Duration: \t\t{}'.format(end_time - start_time))
print(f'Final Pre-image: \t{data}{NONCE}')
with open('output.txt', 'w') as writefile:
writefile.write(f'New Hash is: \t\t{newHash}\n')
writefile.write(f'NONCE is: \t\t{NONCE}\n')
writefile.write('Duration: \t\t{}'.format(end_time - start_time)+'\n')
writefile.write(f'Final Pre-image: \t{data}{NONCE}\n')
"""19785216988"""