OpenTokApi.Core.OpenTok.SignString C# (CSharp) Method

SignString() private static method

private static SignString ( string message, string key ) : string
message string
key string
return string
        private static string SignString(string message, string key)
        {
            var encoding = new ASCIIEncoding();

            var keyByte = encoding.GetBytes(key);

            var hmacsha1 = new HMACSHA1(keyByte);

            var messageBytes = encoding.GetBytes(message);
            var hashmessage = hmacsha1.ComputeHash(messageBytes);

            // Make sure to utilize ToLower() method, else an exception willl be thrown
            // Exception: 1006::Connecting to server to fetch session info failed.
            string result = ByteToString(hashmessage).ToLower();

            return result;
        }