I'm learning a bit of c++ and came across a project on github that implements the SHA256 hashing algorithm. This project has all its code in a header file. This confuses me a little. According to a c++ website(unofficial), the header file is sort of definition(interface) of which methods are available and the cpp file has the implementation of these methods.
Questions:
- Is it "correct" to do the implementation inside your header like the
github project?
- If so, when do you put the implementation in the header?
- If not, does this mean that the sha256 project could be improved by splitting in a header and cpp file?