Untitled

 avatar
unknown
plain_text
3 years ago
672 B
17
Indexable
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...