How can I compute MD5 in a Metro Style app that is written in C#?
Asked
Active
Viewed 1,420 times
6
-
1what does the style have to do with the MD5?? – thumbmunkeys Nov 28 '11 at 14:53
-
1and what does MD5 have to do with Cryptography? – Jan Dragsbaek Nov 28 '11 at 14:54
-
Because it uses a different subset of the .NET BCL, see new tag winrt – flq Nov 28 '11 at 14:54
-
3Now it gets downvotes?! Clearly people don't understand. The runtime of a Metro-Style app uses a different set of the .NET framework than your usual .NET Framework. I.e. in the documentation there is no trace of a security cryptography namespace! – flq Nov 28 '11 at 14:59
-
1For your own sake, elaborate i bit further. I think there's a good question hidden in that one-liner. +1 for a potentially good and valuable question. – Phil Nov 28 '11 at 15:05
-
Metro style apps are sandboxed and use a different profile of .net. So the usual crypto classes might not be available (I didn't check). So being a metro app can certainly be relevant. And MD5 is certainly crypto, just broken crypto. – CodesInChaos Nov 28 '11 at 15:06
-
1Here you can find the answer: http://stackoverflow.com/questions/8299142/how-to-generate-md5-hash-code-for-my-winrt-app-using-c – Alireza Noori Dec 02 '11 at 10:24
2 Answers
1
There is lots of information on the locations of various namespaces for Metro at the Metro style app reference.
I'm not sure about MD5, but the the hashing stuff for SHA is in Windows.Security.Cryptography.Certificates
Obviously we don't know if you really need MD5, but if you don't (i.e. you're not talking to something else that expects MD5) then don't - it's often the go-to hashing for people just because it's more famous, but others are often better for all sorts of reasons.

Cylindric
- 5,858
- 5
- 46
- 68
0
Check out the documentation, apparently this ends up in a Windows namespace. I suspect the HashAlgorithmProvider does what you need, but I couldn't test yet.

flq
- 22,247
- 8
- 55
- 77