Click here to Skip to main content
15,890,845 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hellow Again
How to calculate the files md5 and compare it in VC++
Ive searched in google but no luck ...
Tnx Again :)
Posted

You didn't search too hard then, did you?

I tried using your subject line as a search term and got here straight away: Use Windows Crypto API to calculate a MD5 string.[^]
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 15-Jun-11 20:02pm    
Sure, a 5.
--SA
There's an easier alternative than spinning up the full crypto; have a look at the Message Digest functions[^]

C#
typedef struct {
    ULONG i[2];
    ULONG buf[4];
    unsigned char in[64];
    unsigned char digest[16];
} MD5_CTX;

typedef void (_stdcall *MD5Final)(MD5_CTX* context);
typedef void (_stdcall *MD5Init)(MD5_CTX* context);
typedef void (_stdcall *MD5Update)(MD5_CTX* context,unsigned char* input,unsigned int inlen);


Do a LoadLibrary("cryptdll.dll"), GetProcAddress() for each of the three functions, call MD5Init(), MD5Update() as many times required, then MD5Final(), and FreeLibrary()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900