You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
909 B

10 years ago
md5
===
Class to create MD5 checksum from file or string
10 years ago
<b>Example</b>
```c++
#include "md5/md5.h"
int main(int argc,char** argv){
10 years ago
char cstring[] = "Foo baz, testing.";
10 years ago
std::string str = cstring;
10 years ago
/* MD5 from std::string */
10 years ago
printf("md5sum: %s\n", md5( str ).c_str());
10 years ago
/* MD5 from c-string */
10 years ago
printf("md5sum: %s\n", md5( cstring ).c_str());
10 years ago
/* Short MD5 from c-string */
printf("md5sum6: %s\n", md5sum6( cstring ).c_str());
10 years ago
/* Short MD5 from std::string */
printf("md5sum6: %s\n", md5sum6( str ).c_str());
10 years ago
/* MD5 from filename */
printf("md5file: %s\n", md5file("README.md").c_str());
10 years ago
/* MD5 from opened file */
std::FILE* file = std::fopen("README.md", "rb");
printf("md5file: %s\n", md5file(file).c_str());
std::fclose(file);
10 years ago
10 years ago
/* we're done */
return EXIT_SUCCESS;
10 years ago
}
```
10 years ago
<b>Compilation in g++</b>
<i>g++ -std=c++0x -o md5 md5.cpp main.cpp</i>