private static string CreatePasswordHash(string password, string challengeString)
{
var passwordBuffer = Encoding.UTF8.GetBytes(password);
// same as MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha512).CreateKey(passwordBuffer) in Windows Runtime.
var provider = new HMACSHA512(passwordBuffer);
// Same as CryptographicBuffer.DecodeFromHexString in Windows Runtime.
var challengeBuffer = DecodeFromHexString(challengeString);
// same as CryptographicEngine.Sign(provider, challengeBuffer) in Windows Runtime.
var hmacBytes = provider.ComputeHash(challengeBuffer);
// Same as CryptographicBuffer.EncodeToHexString in Windows Runtime.
return EncodeToHexString(hmacBytes);
}
#endregion