我正在使用一个API示例。如文档注释中所述,此特定代码块已针对Windows Store。 什么是“非Windows Store”调用翻译?
using System;
using System.IO;
using System.Net;
using Windows.Security.Cryptography;
using Windows.Security.Cryptography.Core;
using Windows.Storage.Streams;
protected string Sha256Encode(string stringToEncode)
{
// Note: Windows Store specific namespaces used here. You may need to use slightly different calls for
// server-side implementations.
//What is the non windows store version of this block of code?
IBuffer buffUtf8Msg = CryptographicBuffer.ConvertStringToBinary(stringToEncode, BinaryStringEncoding.Utf8);
HashAlgorithmProvider objAlgProv = HashAlgorithmProvider.OpenAlgorithm(HashAlgorithmNames.Sha256);
// Hash the string
IBuffer buffHash = objAlgProv.HashData(buffUtf8Msg);
string result = CryptographicBuffer.EncodeToHexString(buffHash);
return result;
}