Does the managed WinRT API include a way to comput

2019-06-20 04:50发布

问题:

How can I compute MD5 in a Metro Style app that is written in C#?

回答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.



回答2:

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.