Creating MD5 hash strings in Silverlight v1.1

Posted 24 October 2007  

In the Silverlight v1.1 Alpha CTP bits, there's only the APIs and libraries that are necessary and useful for the rich web client. While working on implementing the Flickr web services API within a .NET-enabled Silverlight sample application, I found that the MD5 algorithm isn't available within the cryptography APIs. Like many REST-based web services, the simple Flickr API uses MD5 along with a form of "signing" with a known secret. A quick search on the web revealed a nice managed code implementation of MD5 that doesn't use any unsafe calls, so it was a cinch to get it running within my managed app. Thought I'd share the file here: Md5.cs. The excellent MD5 implementation was created by the GL Conseil/Flow Group SAS; they did this work to enable MD5 within the Compact Framework 2.0. Calling the function is very simple: MD5CryptoServiceProvider.GetMd5String("This is what I want a hash of!"); Hope this helps! Download "Md5.cs" as text

Jeff Wilcox is a Principal Software Engineer at Microsoft in the Open Source Programs Office, helping Microsoft scale to 10,000+ engineers using, contributing to and releasing open source.

comments powered by Disqus