(fixes #2) The parity was being built overflowing the last block size, when the last block was smaller than the block size.
Therefore, the parity was built with garbage values from the buffer. Now the bounds on the loop are correctly set.