因此,在过去,我曾经使用Windows 8中不可用的System.Security.Cryptography,而我在Windows 8中发现的是windows.security。
但是我没有找到有关如何使用Sha256和密钥的任何示例。
这是我与System.Security.Cryptography一起使用的旧代码
string appID = "appid";
string key = "password";
var hmacsha256 = new HMACSHA256(Encoding.Default.GetBytes(key));
hmacsha256.ComputeHash(Encoding.Default.GetBytes(appID));
string k = "";
foreach (byte test in hmacsha256.Hash)
{
k += test.ToString("X2");
}
最佳答案
根据.NET Framework文档,您使用的类在.NET 4.5中可用,并且在Windows 8中受支持。
http://msdn.microsoft.com/en-us/library/system.security.cryptography.hmacsha256.aspx
如果您在谈论WinRT运行时,则可能是您想要的:http://channel9.msdn.com/Forums/TechOff/Porting-to-WinRT/4df7586e1ef5400682eda00f0143b610
关于c# - 我需要在Windows 8上使用Sha256使用 key 散列消息,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14837421/