C# windowsphone中的SHA-1算法
在我的Windows Phone应用程序中,我需要使用SHA-1算法获取哈希值。我该怎么做?例如,我有C# windowsphone中的SHA-1算法,c#,windows-phone-7,C#,Windows Phone 7,在我的Windows Phone应用程序中,我需要使用SHA-1算法获取哈希值。我该怎么做?例如,我有stringtext=“1234”您可以使用该类来计算字节数组的哈希值。可能会这样做: var sha = new SHA1Managed(); var bytes = System.Text.Encoding.UTF8.GetBytes(text); byte[] resultHash = sha.ComputeHash(bytes); 您应该使用类。重复@revolutionkpi,这并
stringtext=“1234”代码>您可以使用该类来计算字节数组的哈希值。可能会这样做:
var sha = new SHA1Managed();
var bytes = System.Text.Encoding.UTF8.GetBytes(text);
byte[] resultHash = sha.ComputeHash(bytes);
您应该使用类。重复@revolutionkpi,这并不意味着答案没有帮助/正确。如果您需要编写自己的方法,SHA1就是SHA1。在我的情况下,正如我在问题中所述,我想了解如何在Windows Phone中实现这一点)Windows中没有SHA1 CryptoServiceProvider类Phone@KarthikKumarViswanathan,不,它不在Windows Phone上。Windows Phone 7上唯一可用的SHA实现是SHA1Managed
。
var sha = new SHA1Managed();
var bytes = System.Text.Encoding.UTF8.GetBytes(text);
byte[] resultHash = sha.ComputeHash(bytes);