1

Probably a simple question, but I believe it is important to state it clearly for the beginners like me out there.

What is the hash function used for the Bitcoin proof-of-work? What implementations are available? Any Java implementation?

2

Bitcoin uses SHA256d to hash block headers, which is sha256(sha256(x)).

In anticipation of your next question, it uses a double hash to protect against length extension attacks (source).

  • 1
    In reality extension attacks aren't really applicable to proof of work anyway, but convention is probably as good of a reason as any I suppose. – Anonymous Sep 3 '15 at 21:47
1

From Bitcoin Wiki PoW and tangentially, HashCash:

SHA256(SHA256(Block_Header)) but you have to be careful about byte-order.

Specifically, it is SHA256d

Implementations are often standard libraries, like Python's hashlib.

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.