###Dependencies
- Linux
- g++ and GNU make
###How to Run Tests
- Edit the Makefile, make sure
CFLAGS=-c -g -Wall -DSAMPLE_TEST
- If you have built the program before, run
make clean
- In the project directory, run
make
- In the project directory, run
./md5
###How to Use It As a Program
- Edit the Makefile, make sure
CFLAGS=-c -g -Wall
- If you have built the program before, run
make clean
- In the project directory, run
make
- In the project directory, run
./md5
- Enter strings into stdin, the results will be output to stdout
If you want to use redirection, this is an example. (Checkout the test
target in Makefile)
./md5 < testcase/in > testcase/result
###API
-
string md5(const string str)
Sample usage:
#include <iostream> #include "md5.h" using namespace joyee; int main(int argc, char* argv[]) { std::cout << md5("abc") << '\n'; // 900150983cd24fb0d6963f7d28e17f72 return 0; }
-
update
,finalize
,toString
Sample usage:
#include <iostream> #include <cstring> #include "md5.h" using namespace joyee; int main(int argc, char* argv[]) { MD5 md5 = MD5(); int data = 1234; md5.update(reinterpret_cast<char*>(&data), sizeof(data)); md5.finalize(); std::cout << md5.toString() << '\n'; // 099c28f29510c7938bc8c307d287557f return 0; }
###About
- Github repository
- Author: Qiuyi Zhang
- Time: Oct. 2014