Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# windowsphone中的SHA-1算法_C#_Windows Phone 7 - Fatal编程技术网

C# windowsphone中的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,这并

在我的Windows Phone应用程序中,我需要使用SHA-1算法获取哈希值。我该怎么做?例如,我有
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);