Untitled
Anonymous
Plain Text
04/13/2022 5:00 PM
672 B
33
Indexable
Never
from hashlib import sha256
import time
import random
from concurrent.futures import ProcessPoolExecutor, ThreadPoolExecutor
def data(val, diff=4):
su = time.time()
nonce = 0
while True:
s = "test" +str(nonce) + time.ctime()
hash = sha256(s.encode()).hexdigest()
if hash.startswith("0"*diff): print(nonce, diff, hash, time.time()-su)
break
nonce += 1
x = "abcdefghjklmnoprsekdufkvkvmd"
diff = [4,5,6] with ProcessPoolExecutor(max_workers = 4) as exe:
exe.map(data, *zip(*[(x[i], random.choice(diff)) for i in range(11)]))Editor is loading...