1 #ifndef CMD5_H 2 #define CMD5_H 3 4 extern "C" 5 { 6 #ifdef USE_OPENSSL 7 #include <openssl/md5.h> 8 #else 9 #include "md5.h" 10 #endif 11 } 12 13 using namespace std; 14 #include <string> 15 16 class Cmd5 17 { 18 public: 19 Cmd5(); 20 21 void init(); 22 23 // get the sum as a 16byte buffer 24 void getSum(char *buf); 25 // get the sum into a string reference 26 string getSum(); 27 28 // add some more data to the data that has been summed. 29 void addData(const char *buf, size_t bytes); 30 void addData(const string &buf); 31 32 private: 33 MD5_CTX m_context; 34 }; 35 36 #endif 37