2
$\begingroup$

I've found this online currency someone has built as a project and it's "miner" / Proof of Work algorithm is as follows:

  • Generate 32 bytes of random data and hash it, store the original value and the hash
  • Test if the hash begins with a "server key" which is the 3 bytes the hash has to begin with to be valid
  • Submit the value to the server and it will award you with some of the currency and change the server key if the value that you sent's hash begins with these first 3 bytes.

Since a SHA-256 hash is 32 bytes, and I would only need to guarantee the first 3 bytes to mine the currency, would it be possible to get values that produce a hash with these first 3 bytes, but faster than just random hashing?

$\endgroup$
4
$\begingroup$

Cryptographic Hash functions are deterministic random functions. Deterministic means same input same output and random in a sense means that the output is unpredictable. We expect that the hash functions have avalanche effect that whenever one bit complemented from the input, each of the output bits changes with 50% probability.

If it is possible to find a specific first 3-byte faster than the random hashing this actually means that someone found a weakness in the hash function. There is no known such weakness in the SHA-256.

Note: By the design of the SHA-256 (or the family), even there is a non-random method for the first 3-byte, with high probability, the other bytes will have, too.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.