Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. from hashlib import sha256
  2.  
  3. def mineBurro(block):
  4.   nounce = 0
  5.   h = sha256(block.getContent() + str(nounce).encode()).hexdigest()
  6.   block.setHash(h)
  7.   block.setNounce(nounce)
  8.  
  9.   return block
  10.  
  11. def mineMenosBurro(block):
  12.   nounce = 0
  13.  
  14.   while True:
  15.     nounce += 1
  16.     h = sha256(block.getContent() + str(nounce).encode()).hexdigest()
  17.    
  18.     if h[0] == "0" : # hash com 1 zero
  19.       block.setHash(h)
  20.       block.setNounce(nounce)
  21.      
  22.       return block
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement