public void TestHashWrite()
        {
            var stream = new MemoryStream();

            using var blake3Stream = new Blake3Stream(stream);
            blake3Stream.Write(HasherTests.BigData);
            AssertTextAreEqual(HasherTests.BigExpected, blake3Stream.ComputeHash().ToString());
        }
        public void TestHashRead()
        {
            var stream = new MemoryStream(HasherTests.BigData);

            using var blake3Stream = new Blake3Stream(stream);
            blake3Stream.Read(new byte[HasherTests.BigData.Length]);
            AssertTextAreEqual(HasherTests.BigExpected, blake3Stream.ComputeHash().ToString());
        }
Beispiel #3
0
        public void TestHashWrite()
        {
            var stream = new MemoryStream();

            using var blake3Stream = new Blake3Stream(stream);
#if NET5_0
            blake3Stream.Write(HasherTests.BigData);
#else
            blake3Stream.Write(HasherTests.BigData, 0, HasherTests.BigData.Length);
#endif
            AssertTextAreEqual(HasherTests.BigExpected, blake3Stream.ComputeHash().ToString());
        }
Beispiel #4
0
        public void TestHashBufferedRead()
        {
            var stream = new MemoryStream(HasherTests.BigData);

            using var blake3Stream = new Blake3Stream(stream);

            const int bufferSize = 8 * 1024;
            var       buffer     = new byte[bufferSize];

            do
            {
                int bufferDataLength = FillBuffer(blake3Stream, ref buffer);
                if (bufferDataLength == 0)
                {
                    break;
                }
            } while (true);

            AssertTextAreEqual(HasherTests.BigExpected, blake3Stream.ComputeHash().ToString());
        }