private CrcResponse GetHash(string crc_token) { byte[] keyByte = new ASCIIEncoding().GetBytes(_consumerSecret); byte[] messageBytes = new ASCIIEncoding().GetBytes(crc_token); byte[] hashmessage = new HMACSHA256(keyByte).ComputeHash(messageBytes); // to lowercase hexits //String.Concat(Array.ConvertAll(hashmessage, x => x.ToString("x2"))); String.Concat(hashmessage.Select(element => element.ToString("x2")).ToArray()); // to base64 return(new CrcResponse { response_token = Convert.ToBase64String(hashmessage) }); }