Facebook.FacebookClient.ComputeHmacSha256Hash C# (CSharp) Method

ComputeHmacSha256Hash() private static method

Computes the Hmac Sha 256 Hash.
private static ComputeHmacSha256Hash ( byte data, byte key ) : byte[]
data byte /// The data to hash. ///
key byte /// The hash key. ///
return byte[]
        private static byte[] ComputeHmacSha256Hash(byte[] data, byte[] key)
        {
            //https://channel9.msdn.com/Forums/TechOff/Porting-to-WinRT/4df7586e1ef5400682eda00f0143b610

            MacAlgorithmProvider macAlgorithmProvider = MacAlgorithmProvider.OpenAlgorithm("HMAC_SHA256");
            //BinaryStringEncoding encoding = BinaryStringEncoding.Utf8;

            CryptographicKey hmacKey = macAlgorithmProvider.CreateKey(key.AsBuffer());
            IBuffer signedMessage = CryptographicEngine.Sign(hmacKey, data.AsBuffer());
            //var hashedString  = CryptographicBuffer.EncodeToBase64String(signedMessage);
            
            return signedMessage.ToArray();

            ////using (var crypto = new HMACSHA256(key))
            ////{
            ////    return crypto.ComputeHash(data);
            ////}
        }