md5
-
google - there are plenty of MD5 examples available online. Christian Graus - Microsoft MVP - C++
-
google - there are plenty of MD5 examples available online. Christian Graus - Microsoft MVP - C++
-
thats what i am doing write now... but all i am finding is forums about ppl asking what php's md5() function is for...
-
Any set of C functions would integrate nicely with MFC. Here's[^] one C-implementation. All you have to do is to copy'n'paste, and you're set.
char text[] = "your text here";
md5_context ctx;
md5_starts(&ctx);
md5_update(&ctx, (unsigned char*)text, sizeof(text));
unsigned char md5hash[16];
md5_finish(&ctx, md5hash);There you go! Please note that the contents of
md5hash
will be in binary format. It's not a string, it's an array of exactly 16 bytes. If you need to convert it into a string, then you'll have to do something like this:char hashtext[33];
for(int i = 0; i < 16; ++i) {
unsigned char hinibble = ((md5hash[i] & 0xF0) >> 4);
unsigned char lonibble = md5hash[i] & 0xF;
hashtext[i * 2] = hinibble >= ? (hinibble - 10) + 'A' : hinibble + '0';
hashtext[i * 2 + 1] = lonibble >= ? (lonibble - 10) + 'A' : lonibble + '0';
}
hashtext[32] = 0; // terminate stringhashtext
will now contain the hash on a hexadecimal form. Also note that the input can be any kind of data, it doesn't have to be text! Any byte chunk would do. Good music: In my rosary[^] -
I've had an md5 implementation here on Codeproject for years and years. It works fine, although its pretty old fashioned code. There are several other MD5 examples here. You can also use the MS Crypto API, look up the documentation for CryptCreateHash in Platform SDK.
-
you have some help on codeproject befor doing google always check codeproject http://www.codeproject.com/cpp/cryptest.asp Love is photogenic,It requires a dark to develope.