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?

| improve this question | | | | |
$\endgroup$
4
$\begingroup$

Cryptographic Hash functions are deterministic random functions. Deterministic means the same input the same output and random in a sense mean 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 flips with a 50% probability.

If it is possible to find a specific first 3-byte faster than the hashing random inputs 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.

| improve this answer | | | | |
$\endgroup$
  • $\begingroup$ It is not Random, exists logic behind, but it is hardly predictable enough to say that it is unpredictable. A "hasher" decryptor could check if an input hash matches with some output like "000abcdef1234567890..XXXX" where X bytes can be anyone and in anywhere you want. $\endgroup$ – Izar Urdin Mar 6 at 18:42
  • $\begingroup$ @IzarUrdin A said in a sense. If you have the computing power then it is not unpredictable anymore. This doesn't mean that there won't be new sophisticated attacks. The OP asked but faster than just random hashing?One can already start the test inputs to match as in the bruteforce. $\endgroup$ – kelalaka Mar 6 at 20:09

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.