Where in the Bitcoin github repo is the SHA-256 hashing algorithm defined? Is it a methematical formula?

1 Answer 1


The SHA-256 algorithm is not defined in the Bitcoin GitHub repository, it is defined in the USA Federal Information Processing Standards (FIPS) publication 180-2 (see Wikipedia: SHA-2).

The implementation in Bitcoin Core is in src/crypto/sha256.cpp, src/crypto/sha256.h and related source files and/or dependencies.

If I was looking for a definition that might include a mathematical formalism that describes the algorithm, I would read the FIPS document.

If I was looking for working C++ code available under an open source licence, I would look at the above files in the Github repository.


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.