I haven't written an article for a long time. Today I am writing about the problems I encountered when performing MD5 calculation:
WP7 does not currently have a native MD5 library.
Baidu's "WP7 MD5", a lot of MD5 computing articles will appear, and some will directly post the code. I copied the Code a few days ago and tested it, then I assume that the code is correct. Today, when I interact with the server, I cannot upload a piece of data. The server returns an MD5 error, this caused me to consider the correctness of the MD5 code. After many tests, I finally confirmed that there was a problem with this code.
But the problem has been solved. Please refer to the link below to download the V3 version directly (V1 and V2 versions all have bugs ).
Http://archive.msdn.microsoft.com/SilverlightMD5/Release/ProjectReleases.aspx? Releaseid = 5701
When used: var md5string = md5core. gethashstring (partbytes );
The main content of this article is the above three sentences ......
Let's talk a little more: I found that some people like to post an article directly after that piece of code, and do not test the correctness of the Code, or even write nothing about the source, this is just a pitfall. algorithms like MD5 are not very well tested. Who has used MD5 in the project and directly copied the code from the Internet? If you have time, check whether it is the latest version. (Of course, the latest version cannot ensure that there is no bug, I did not test ).
By the way, when we solve this problem, we found the link above, which was found by Bing, not Baidu ......