The attached project is a simple demonstration of using the Windows Crypto functions to create a hash. The example produces an MD5 hash of a file or a typed in string and returns it in hex.
It could easily be modified to return a Byte array of the hash, and could also easily perform an SHA1, etc. hash instead of MD5.
This can also be done easily via CAPICOM, which is a COM wrapper for the API calls used here. You can download CAPICOM from Microsoft if you don't have it installed, but this program doesn't use or require it.
There is some confusion around the use of these Crypto functions on Win9X. The documentation says Win95 OSR2 or later. Other people suggest you must have a recent version of the UnicoWS.dll installed first.
"Your mileage may vary."
Last edited by dilettante; May 31st, 2008 at 01:09 PM.
Reason: Small change made in raised exception text.