private static string BuildDataString(NameValuePair[] parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException("parameters");
            }

            var builder = new StringBuilder();

            var orderedParameters =
                parameters.Where(p => string.IsNullOrEmpty(p.Name) && !string.IsNullOrEmpty(p.Value))
                    .Union(
                        parameters.Where(p => !string.IsNullOrEmpty(p.Name) && !string.IsNullOrEmpty(p.Value))
                            .OrderBy(i => i.Name))
                    .ToList();

            foreach (var parameter in orderedParameters)
            {
                if (builder.Length > 0)
                {
                    builder.Append(ParameterSeparator);
                }

                if (!string.IsNullOrEmpty(parameter.Name))
                {
                    builder.Append(parameter.Name);
                    builder.Append(NameValueSeparator);
                }

                builder.Append(parameter.Value);
            }

            var data = builder.ToString();
            return data;
        }
 public static string GetHashString(Func<byte[], HMAC> hmacFactory, string secretKey, NameValuePair[] parameters)
 {
     var data = BuildDataString(parameters);
     return ComputeHash(hmacFactory, secretKey, data);
 }