HLRichardson-Git / Gestalt

A user-friendly cryptography library
https://gestaltcrypto.github.io
MIT License
2 stars 2 forks source link

Implement the SHA1 standard #14

Closed HLRichardson-Git closed 7 months ago

HLRichardson-Git commented 7 months ago

Implementation

Follow FIPS 180-1 standard to implement the SHA-1 hashing algorithm. It would also be best to try to follow the naming conventions from the standard, so it is easier for future developers to follow along with your implementation and the standard.

After the Gestalt v0.2 update we are no longer using a single include, and moved from a class based front-end to function based. So when you complete your implementation create a new file under src/sha1/sha1.cpp, along with any other files you need to implement SHA1, and a new header in include/gestalt/sha1.h where the functions for a user to use SHA1 should be.

For an example of how this should be structured see the AES implementation.

Testing

Don't forget to write a new tests/sha1Tests.cpp file to test your implementation. I suggest again following the AES implementation, of implementation structure (i.e. a SHA1 class, and a SHA1 testing friend class), and unit test structure. It will probably be better to first make a few Known Answer Tests, which can be found in the FIPS 180-1 standard starting from pg 12.

Note

I understand SHA1 is not considered secure, and is to be phased out by 2030. But it doesn't seem like a hard algorithm to implement, and if a user doesn't want to use it they don't have to.

Let me know if you have any questions.

HLRichardson-Git commented 7 months ago

Check out branch 14-implement-the-sha1-standard to see my latest additions.

To summarize them: