Exemple #1
0
        public void CalculatingHashInChunksReturnsSameResultAsInOneGo(int length, int chuck)
        {
            var bytes  = new byte[length];
            var random = new Random(0);

            random.NextBytes(bytes);

            var transform = new XXHash64();
            var i         = 0;

            while (i < length)
            {
                var l = Math.Min(chuck, length - i);
                transform.Update(bytes, i, l);
                i += l;
            }

            Assert.Equal(XXHash64.DigestOf(bytes, 0, bytes.Length), transform.Digest());
        }