Silverlight 2: MD5 hash string provider implementation

Posted 5 March 2008  

The cryptography services in Silverlight today only include the SH1 algorithm.  That's quite useful, but throughout the web there is still a significant use of the MD5 algorithm today.  This is a re-post of a managed code implementation of MD5 that has been working great for my Flickr API work. To use this component in your own Silverlight 2 Beta 1 project, you can grab the bits either way: Download Md5.cs Download JeffWilcox.Md5.dll (zip, referenced component can be used by C# and VB Silverlight 2 beta 1 apps) The MD5 types are in the namespace JeffWilcox.Utilities.Silverlight, so that it doesn't clash with anything.  Feel free to rename the namespace to suit your project's needs.  The easiest way to use these bits is just to add a reference to the assembly to your project, the MD5 assembly will then be included in your finished app's .Xap file. While working on implementing the Flickr web services API within a .NET-enabled Silverlight sample application, I needed to use the MD5 algorithm that 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. 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.  In C#: And in VB:   Hope this helps!

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