An open source, indepedent and easy to use SHA1 for C/C++.
2025-11-21: The autoconf branch renamed to main and set as the default. The old main that contains the raw .h file renamed to old_raw.
v0.0.1 - First Tested Version
WARNING: This lib is currently BETA. Some functions may not work correctly and some function structures may change in future versions.
- STD: C89 or newer
At the beginning of the file:
#include <sha1.h>Then:
unsigned char* text_str = "this text will be hashed";
unsigned char* sha1_hash = sha1(text_str, strlen(text_str));For complete examples, see examples directory.
When compiling use -lsha1 to include the library.
For example.c:
gcc example.c -o example -lsha1
You can compile example1.c and example2.c from the examples dir to test the lib. If output is A94A8FE5CCB19BA61C4C0873D391E987982FBBD3, it means that the lib is working correctly.
For test info see TESTS.md