473,573 Members | 4,147 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

(.NET) MD5CryptoServic eProvider and (Win32 CSP) CryptHashData/CryptGetHashPar am return two different Hash values,...

Hi,

this is not a pure MFC/VC++ question but my apologizes at first.
Well, i have a application that calculates the hash for a file. You
can request a CALG_SHA1 or a CALG_MD5 for the File. The
Process of Hash Calculation works fine, but i get two totally different
Hash values for e.g. kernel32.dll when i try to get the hash with the
following steps compared to the managed .NET MD5 Provider.

The Hash "24d244d0a15ab1 7885d578d1c54d5 294" comes from
the following steps:
CryptAcquireCon textW
CryptCreateHash
CryptHashData
CryptGetHashPar am, with HP_HASHSIZE
CryptGetHashPar am, with HP_HASHVAL

The Hash "8eea8280a1e0e7 94edfccad3721c7 cab"
comes from the .NET CSP "MD5CryptoServi ceProvider"
and seems to be the right one (compared to other MD5 tools),
but why does the Windows API CSP return crap?

I can post code if you like (its a little bit to long to post here), but
the code works with no problems,...

Here is a screenshot if you like:
http://entwicklung.junetz.de/pics/verinfo_hash.jpg

I am a little confused,...

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."

Jan 4 '08 #1
4 2699
Dude, i am god-damn stupid, i am the most stupid
human being on earth, i swear to god! I forget to read
the file content to the memory i allocated with VirtualAlloc.
Smack me,...punish me, hit me....

I did a raw look at the memory and then i asked myself why
everthing is full of zeros (MEM_COMMIT). And then it HIT me
like a baseball-bat.

Damn! OMG!!!!

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Jan 4 '08 #2
Now it looks like this:
http://entwicklung.junetz.de/pics/verinfo_hash_ok.jpg

*grml*

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Jan 4 '08 #3
Hey! It looks like they match!

:)

Cheers,
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
"Kerem Gümrükcü" <ka*******@hotm ail.comwrote in message
news:ug******** ******@TK2MSFTN GP05.phx.gbl...
Now it looks like this:
http://entwicklung.junetz.de/pics/verinfo_hash_ok.jpg

*grml*

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Jan 4 '08 #4
Hi Mark,

this happens when you try to make the code perfect.
You forget the data ,... :-D

SMACK ME!!! :-P

Regards

Kerem

--
-----------------------
Beste Grüsse / Best regards / Votre bien devoue
Kerem Gümrükcü
Microsoft Live Space: http://kerem-g.spaces.live.com/
Latest Open-Source Projects: http://entwicklung.junetz.de
-----------------------
"This reply is provided as is, without warranty express or implied."
Jan 5 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3033
by: Derrick | last post by:
I need to generate an MD5 hash in ASP, not ASP.NET, and have that hash be the same as what is produced by the .NET MD5CryptoServiceProvider, any ideas? I found a few examples that return MD5 hash as hex string, how can I resolve that with the byte that .NET MD5 implementation gives me? Thanks in advance! Derrick
0
3829
by: KENNY L. CHEN | last post by:
I have a table with a CHAR column which stored a COBOL redefined record. I tried to retrieve part of the field from the column with Oracle substr function. Here is one of example: The SQL/result are shown below: SQL: select length(substr(MY_COLUMN,36,8)) str_length, dump(substr(MY_COLUMN,36,8)) INFO,
4
6927
by: LamNgo | last post by:
Hi group, I have two application that need to communicate with each other, one written in C++ and the other in VB.NET. To communicate, I use "SendMessage" API to send message from C++ app to VB.NET app. But I don't know why the RegisterMessage API return different value for the same message string in C++ and VB.NET??? This is the code...
2
1336
by: | last post by:
Greets, All I'm looking for a list or website of datatypes VB.net has like double long and thier min max values TIA Thanks
3
2262
by: Gary B. Levy | last post by:
I need to install (for a developer associate. I am NOT a developer)VB.NET versions 6 & 7 on two dissimilar hardware platforms, both running Windows XP Professional with Service Pack 2. Both are Dell platforms. One is a laptop. One is a tower. 1. Does the "default" install suffice in most cases? 2. Are there any caveats or pitfalls to watch...
1
1355
by: syang8 | last post by:
I want to declare a function F() in a class, which has two children A and B. I need A.func() return int and B.func() return double. How can I do that? The F() in parent can be empty or virtual, I just need the declaration. No implementation is required.
1
3584
by: Wayne Deleersnyder | last post by:
Hi All, I was going to write and ask if someone could help me fix the formatting of my output for hash values, but I believe I got it right now. But, because I couldn't find any website or tutorial to help me with this issue I figured I'd make a post just in case someone else runs into the same issue. ....
1
2275
by: bhavanirayala | last post by:
Hi, How can I get the hash values without loop? i.e I want to assign the value of a first key to one variable based on the condition.If that condition falis i need to assign the second value to that variable. The code should be as follows: Here I am getting values by parsing the xml file.
5
1973
by: arggg | last post by:
I'm a bit confused on this one. I created a DLL in 3.5 .NET and on my Vista Laptop the md5 hash is different from the md5 hash on my XP Desktop. It is the EXACT same file as I downloaded it from the same location however they both run fine just the hash is different? Can anyone explain this? I have my update program checking files hash's...
0
7789
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7707
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7800
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8086
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6432
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5296
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3737
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3743
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2227
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.