Changeset 6492
- Timestamp:
- 08/24/08 00:32:58 (3 months ago)
- Location:
- trunk/licq
- Files:
-
- 2 modified
-
include/licq_md5.h (modified) (1 diff)
-
src/md5.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/licq/include/licq_md5.h
r6486 r6492 10 10 #define MD5_H 11 11 12 #include <string> 13 14 std::string md5(const std::string&); 12 #define MD5_DIGEST_LENGTH 16 15 13 16 14 #define UINT8 unsigned char 17 15 #define UINT32 unsigned long 16 17 void md5(const UINT8* buf, unsigned int len, UINT8* digest); 18 18 19 19 struct MD5Context { -
trunk/licq/src/md5.cpp
r6486 r6492 20 20 21 21 #include <cstring> /* for memcpy() */ 22 #include <string>23 22 24 23 #include "licq_md5.h" 25 24 26 std::string md5(const std::string& toHash)25 void md5(const UINT8* buf, unsigned int len, UINT8* digest) 27 26 { 28 27 MD5Context context; 29 UINT8 digest[16];30 28 31 29 MD5Init(&context); 32 MD5Update(&context, reinterpret_cast<const unsigned char *>(toHash.c_str()), toHash.size());30 MD5Update(&context, buf, len); 33 31 MD5Final(digest, &context); 34 35 std::string result(reinterpret_cast<const char *>(digest));36 return result;37 32 } 38 33
