SHA1管理在Windows Phone 8.1中

Had*_*dis 3 windows encryption sha1 windows-phone-8.1

我一直在使用这个开发Windows Phone 8应用程序哈希字符串,但我在Windows Phone 8.1中找不到相同的东西

SHA1Managed sha1 = new SHA1Managed();
byte[] res = sha1.ComputeHash(System.Text.Encoding.UTF8.GetBytes(this.Uuid + this.SessionToken));
return BitConverter.ToString(res, 0, res.Length).Replace("-", "").ToLower();
Run Code Online (Sandbox Code Playgroud)

如何使用SHA1在Windows Phone 8.1中计算哈希?

Der*_*tie 5

HashAlgorithmProvider hashProvider = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha1);
IBuffer hash = hashProvider.HashData(CryptographicBuffer.ConvertStringToBinary(someValue, BinaryStringEncoding.Utf8));
string hashValue = CryptographicBuffer.EncodeToBase64String(hash);
Run Code Online (Sandbox Code Playgroud)