<commit_before>﻿using System.Collections.Generic;

namespace BitcoinUtilities
{
    //todo: write test
    public class ByteArrayComparer : IEqualityComparer<byte[]>
    {
        private static readonly ByteArrayComparer instance = new ByteArrayComparer();

        private ByteArrayComparer()
        {
        }

        public static ByteArrayComparer Instance
        {
            get { return instance; }
        }

        public bool Equals(byte[] x, byte[] y)
        {
            if (x == y)
            {
                return true;
            }
            if (x == null || y == null)
            {
                return false;
            }
            if (x.Length != y.Length)
            {
                return false;
            }
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] != y[i])
                {
                    return false;
                }
            }
            return true;
        }

        public int GetHashCode(byte[] obj)
        {
            if (obj == null)
            {
                return 0;
            }
            int hash = 0;
            for (int i = 0; i < obj.Length; i++)
            {
                hash = hash*37 + obj[i];
            }
            return hash;
        }
    }
}<commit_msg>Used more standard conts in the ByteArrayComparer.GetHashCode.<commit_after>﻿using System.Collections.Generic;

namespace BitcoinUtilities
{
    //todo: write test
    public class ByteArrayComparer : IEqualityComparer<byte[]>
    {
        private static readonly ByteArrayComparer instance = new ByteArrayComparer();

        private ByteArrayComparer()
        {
        }

        public static ByteArrayComparer Instance
        {
            get { return instance; }
        }

        public bool Equals(byte[] x, byte[] y)
        {
            if (x == y)
            {
                return true;
            }
            if (x == null || y == null)
            {
                return false;
            }
            if (x.Length != y.Length)
            {
                return false;
            }
            for (int i = 0; i < x.Length; i++)
            {
                if (x[i] != y[i])
                {
                    return false;
                }
            }
            return true;
        }

        public int GetHashCode(byte[] obj)
        {
            if (obj == null)
            {
                return 0;
            }
            int hash = 23;
            for (int i = 0; i < obj.Length; i++)
            {
                hash = hash*31 + obj[i];
            }
            return hash;
        }
    }
}
{'fraction_non_alphanumeric': 0.09405568096313018, 'fraction_numerical': 0.004890895410082769, 'mean_word_length': 0.9537105069801617, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, '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': '3295292', 'n_tokens_mistral': 718, 'n_tokens_neox': 683, 'n_words': 182}