Changeset 726
- Timestamp:
- 01/17/12 12:47:13 (4 months ago)
- Files:
-
- 4 edited
-
branches/1.0/sources/common/include/utils/misc/crypto.h (modified) (3 diffs)
-
branches/1.0/sources/common/src/utils/misc/crypto.cpp (modified) (3 diffs)
-
trunk/sources/common/include/utils/misc/crypto.h (modified) (3 diffs)
-
trunk/sources/common/src/utils/misc/crypto.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/sources/common/include/utils/misc/crypto.h
r395 r726 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 75 75 */ 76 76 bool CreateSharedKey(uint8_t *pPeerPublicKey, int32_t length); 77 77 78 78 /*! 79 79 @brief Copies the shared secret key. … … 90 90 RC4_KEY *rc4keyIn, RC4_KEY *rc4keyOut); 91 91 DLLEXP string md5(string source, bool textResult); 92 DLLEXP string md5(uint8_t *pBuffer, uint32_t length, bool textResult); 92 93 DLLEXP void HMACsha256(const void *pData, uint32_t dataLength, const void *pKey, 93 94 uint32_t keyLength, void *pResult); -
branches/1.0/sources/common/src/utils/misc/crypto.cpp
r653 r726 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 217 217 218 218 string md5(string source, bool textResult) { 219 return md5((uint8_t*) source.c_str(), source.length(), textResult); 220 } 221 222 string md5(uint8_t *pBuffer, uint32_t length, bool textResult) { 219 223 EVP_MD_CTX mdctx; 220 224 unsigned char md_value[EVP_MAX_MD_SIZE]; … … 222 226 223 227 EVP_DigestInit(&mdctx, EVP_md5()); 224 EVP_DigestUpdate(&mdctx, STR(source), source.length());228 EVP_DigestUpdate(&mdctx, pBuffer, length); 225 229 EVP_DigestFinal_ex(&mdctx, md_value, &md_len); 226 230 EVP_MD_CTX_cleanup(&mdctx); -
trunk/sources/common/include/utils/misc/crypto.h
r395 r726 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 75 75 */ 76 76 bool CreateSharedKey(uint8_t *pPeerPublicKey, int32_t length); 77 77 78 78 /*! 79 79 @brief Copies the shared secret key. … … 90 90 RC4_KEY *rc4keyIn, RC4_KEY *rc4keyOut); 91 91 DLLEXP string md5(string source, bool textResult); 92 DLLEXP string md5(uint8_t *pBuffer, uint32_t length, bool textResult); 92 93 DLLEXP void HMACsha256(const void *pData, uint32_t dataLength, const void *pKey, 93 94 uint32_t keyLength, void *pResult); -
trunk/sources/common/src/utils/misc/crypto.cpp
r722 r726 1 /* 1 /* 2 2 * Copyright (c) 2010, 3 3 * Gavriloaie Eugen-Andrei (shiretu@gmail.com) … … 217 217 218 218 string md5(string source, bool textResult) { 219 return md5((uint8_t*) source.c_str(), source.length(), textResult); 220 } 221 222 string md5(uint8_t *pBuffer, uint32_t length, bool textResult) { 219 223 EVP_MD_CTX mdctx; 220 224 unsigned char md_value[EVP_MAX_MD_SIZE]; … … 222 226 223 227 EVP_DigestInit(&mdctx, EVP_md5()); 224 EVP_DigestUpdate(&mdctx, STR(source), source.length());228 EVP_DigestUpdate(&mdctx, pBuffer, length); 225 229 EVP_DigestFinal_ex(&mdctx, md_value, &md_len); 226 230 EVP_MD_CTX_cleanup(&mdctx);
Note: See TracChangeset
for help on using the changeset viewer.
