Here's how I'd create a MD5 hash...
Not that anyone cares, but here's how I'd create a MD5 hash:
#include <windows.h>
#include <wincrypt.h>
#define StrLen wcslen
typedef unsigned char uchar ;
typedef unsigned long ulong ; typedef unsigned __int64 u64 ;
typedef uchar * _LnP ; typedef wchar_t * LnP ;
const int SzChar = sizeof ( wchar_t );
#pragma warning( disable: 4430 4508 )
u64 Hash[ 2 ];
HashIt( LnP B ) { HCRYPTPROV hProv ; HCRYPTHASH hHash ;
CryptAcquireContext(
& hProv, 0, 0, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT );
CryptCreateHash( hProv, CALG_MD5, 0, 0, & hHash );
CryptHashData( hHash, _LnP( B ), StrLen( B ) * SzChar, 0 );
ulong SzHash = sizeof Hash ; // In and out
CryptGetHashParam( hHash, HP_HASHVAL, _LnP( Hash ), & SzHash, 0 );
CryptDestroyHash( hHash ); CryptReleaseContext( hProv, 0 ); }
int __stdcall WinMain( HINSTANCE, HINSTANCE, char*, int ) {
HashIt( L"Hello World" );
// Breaking here, ??? * Hash == 0xec085830543af7e9 ???.
HashIt( L"X" );
// Here ??? * Hash == 0xedfa68d340749cd5 ???.
HashIt( L"Hello World" );
// Here, again, ??? * Hash == 0xec085830543af7e9 ???.
}