예제 #1
0
        public void Combine_should_correctly_combine_multiple_hashes()
        {
            var usualHash    = Crc32Fast.Compute(data);
            var combinedHash = PartitionData().Aggregate(0U, (current, segment) => Crc32Fast.Combine(current, Crc32Fast.Compute(segment), segment.Count));

            combinedHash.Should().Be(usualHash);
        }
예제 #2
0
        public void Combine_should_return_second_hash_if_first_hash_is_zero()
        {
            const uint crc1    = 0;
            const uint crc2    = 100500;
            const int  length2 = 123;

            var combinedHash = Crc32Fast.Combine(crc1, crc2, length2);

            combinedHash.Should().Be(crc2);
        }