I copy-pasted from MSDN this code:
using System.Security.Cryptography;
byte[] buffer = enc.GetBytes(text);
SHA1CryptoServiceProvider cryptoTransformSHA1 =
new SHA1CryptoServiceProvider();
string hash = BitConverter.ToString(
cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", "");
return hash;
but VS says there is no such Cryptography namespace, thus there is no SHA1CryptoServiceProvider class.
What am I doing wrong?
I am using Visual Studio Professional 2012 RC with Dreamspark license on Windows 8 Release Preview.
I take it that you are trying to create a Metro application? Metro-style applications do not support the
System.Security.Cryptographynamespace. The complete list of supported .NET API namespaces for Metro applications can be found here.UPDATE JUNE 29
As Guillermo has pointed out though, there is the Windows.Security.Cryptograhy.Core namespace, that contains a HashAlgorithmProvider class where e.g. the SHA1 algorithm can be applied.