public void TransformBlockAndTransformFinalBlock() { var data = new byte[] { 10, 13, 25, 14, 26, 5, 7, 9, 1, 12, 11, 54, 13, 54, 15, 17, 87, 16, 92, 20, 21, 25, 65, 78, 65, 43, 12, 53, 79, 80, 1, 32, 34, 56, 43, 6, 1, 56, 1, 12, 11, 54, 13, 54, 15, 17, 87, 16, 92, 20, 21, 25, 65, 78, 65, 43, 12, 53, 79, 1, 12, 11, 54, 13, 54, 15, 17, 87, 16, 92, 20, 21, 25, 65, 78, 65, 43, 12, 53, 79, 5 }; var expectedHash = new byte[] { 128, 163, 23, 117, 156, 106, 169, 171, 211, 31, 95, 85, 66, 31, 232, 41, 115, 58, 148, 22 }; var outputBuffer = new byte[100]; var actual1 = _hashAlgorithm.TransformBlock(data, 0, 70, outputBuffer, 0); Assert.Equal(70, actual1); Assert.Equal(ByteExtensions.Take(data, 0, 70), ByteExtensions.Take(outputBuffer, 0, 70)); Assert.Equal(ByteExtensions.Repeat(0, 30), ByteExtensions.Take(outputBuffer, 70, 30)); var actual2 = _hashAlgorithm.TransformBlock(data, 70, 6, outputBuffer, 15); Assert.Equal(6, actual2); Assert.Equal(ByteExtensions.Take(data, 0, 15), ByteExtensions.Take(outputBuffer, 0, 15)); Assert.Equal(ByteExtensions.Take(data, 70, 6), ByteExtensions.Take(outputBuffer, 15, 6)); Assert.Equal(ByteExtensions.Take(data, 21, 49), ByteExtensions.Take(outputBuffer, 21, 49)); Assert.Equal(ByteExtensions.Repeat(0, 30), ByteExtensions.Take(outputBuffer, 70, 30)); var actual3 = _hashAlgorithm.TransformFinalBlock(data, 76, 5); Assert.Equal(ByteExtensions.Take(data, 76, 5), actual3); Assert.Equal(expectedHash, _hashAlgorithm.Hash); }