Earlier quoted context omitted.
Sorry, my age may be lower than five. I don't understand. You explain that a hash is computed over a string that is the concatenation of a server key, a random number and a client adjusted nonce. you then lost me with the four bytes. I thought that we were talking about a string of chars, not an array of bytes. The nonce is an integer value ? The client then increases the nonce value I guess. But how does the client…
The basic idea is: The client has to create a hash that satisfies a certain condition: Like the first n-digits must be 0, or maybe "the last bytes (when interpreted as a single 32 number) must be larger than x". So the client does this: from itertools import count import hashlib for i in count(): h = hashlib.md5("some-nonce:%d" % i).hexdigest() if h.startswith("000000"): print i break The value "some-nonce" is provid…
To use your example, it must be 100% certain that a hash with 6 leading zeros is possible to generate with md5.
Also, I'm assuming you don't want clients spending too long on the problem, so it seems like you'd want to have a prediction of roughly how long it would take to compute the answer. Otherwise one client may get lucky after 10 iterations whist another may take 10 million. Are hashing functions predictable in that manner?