Skip to content

Instantly share code, notes, and snippets.

import hashlib
import hmac
import time
def cycledigest(text,counter=0,level=2,hash=hashlib.sha1):
i=counter
while True:
mac=hmac.new((i).to_bytes(4,'big'),bytearray(text,'utf8'),hash)
if mac.hexdigest().startswith('0'*level):
break