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 Answers 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.
    – Claris
    Commented Sep 3, 2015 at 21:47

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 and acknowledge you have read our privacy policy.

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