> From: owner-openssl-us...@openssl.org On Behalf Of lu_hernan > Sent: Friday, 04 February, 2011 19:14
> openssl dgst -md5 sometextdata.txt > > it gives an answer XYZ > > but using this code en visual c++: > const unsigned char data[]="text from file: sometextdata.txt"; > unsigned char md[MD5_DIGEST_LENGTH]; > MD5(data, strlen(data), md); > > it gives ABC as result. > Make sure the data is exactly byte-for-byte the same. In particular, does the file have a CR-LF, or maybe just LF, at the end? My ancient MSVC++6 (circa 1998) has an option on File / Open: OpenAs=Binary . If that or something similar is available, it should show exactly what's in the file. If not do a simple program like: #include <stdio.h> int main(void){ FILE * fp = fopen ("sometextdata.txt", "rb"); /* b matters on Win */ unsigned char buff[99999]; int i, n = fread (buff,1,sizeof buff, fp); for( i = 0; i < n; i++ ) printf ("%c%02X", " \n"[!(i&0xF)], buff[i]); printf ("\n"); fclose (fp); return 0; } ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org