<commit_before>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using RestSharp;
using System.Collections.Specialized;
using System.Collections;
using System.Security.Cryptography;

namespace TrackingApp.Droid
{
    public class AuthorizationHelper
    {
        public AuthorizationHelper(string account, string key)
        {
            Account = account;
            Key = key;
        }

        public string Account { get; private set; }
        public string Key { get; private set; }

        public string Get(Method method, DateTime time, string resource)
        {
            var methodName = Enum.GetName(typeof(Method), method).ToUpperInvariant();
            var signature = string.Format("{0}\n\n{1}\n{2}\n{3}",
                    methodName,
                    "application/json",
                    time.ToString("R", System.Globalization.CultureInfo.InvariantCulture),
                    GetCanonicalizedResource(resource, Account)
                    );
            var header = "SharedKey {0}:{1}";
            var bytes = Encoding.UTF8.GetBytes(signature);
            using (var hash = new HMACSHA256(Convert.FromBase64String(Key)))
            {
                header = string.Format(header, Account, Convert.ToBase64String(hash.ComputeHash(bytes)));
            }
            return header;
        }

        private string GetCanonicalizedResource(string resource, string accountName)
        {
            var sanitized = resource;
            if (sanitized.StartsWith("/")) sanitized = sanitized.Remove(0, 1);
            return string.Format("/{0}/{1}", accountName, sanitized);
        }
    }
}<commit_msg>changed how the authorization headers are processed<commit_after>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using RestSharp;
using System.Collections.Specialized;
using System.Collections;
using System.Security.Cryptography;

namespace TrackingApp.Droid
{
    public class AuthorizationHelper
    {
        public AuthorizationHelper(string account, string key)
        {
            Account = account;
            Key = key;
        }

        public string Account { get; private set; }
        public string Key { get; private set; }

        public string Get(Method method, DateTime time, string tableName)
        {
            var methodName = Enum.GetName(typeof(Method), method).ToUpperInvariant();
            var signature = string.Format("{0}\n\n{1}\n{2}\n{3}",
                    methodName,
                    "application/json",
                    time.ToHeader(),
                    GetCanonicalizedResource(tableName)
                    );
            var header = "SharedKey {0}:{1}";
            var bytes = Encoding.UTF8.GetBytes(signature);
            using (var hash = new HMACSHA256(Convert.FromBase64String(Key)))
            {
                header = string.Format(header, Account, Convert.ToBase64String(hash.ComputeHash(bytes)));
            }
            return header;
        }

        private string GetCanonicalizedResource(string resource)
        {
            var sanitized = resource;
            if (sanitized.StartsWith("/")) sanitized = sanitized.Remove(0, 1);
            return string.Format("/{0}/{1}", Account, sanitized);
        }
    }
}
{'fraction_non_alphanumeric': 0.10030820958251611, 'fraction_numerical': 0.010086859064163631, 'mean_word_length': 2.2220216606498195, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '815470', 'n_tokens_mistral': 944, 'n_tokens_neox': 909, 'n_words': 224}