Calculate exclusive-or of a byte array
<p>Hello so for an assignment I have to implement a simple hash for a file. The parameters are as followed:</p>

<ol>
<li>If the input length measured in the number of bytes is not a multiple of 4, add 0s to the end until it is a multiple of 4.</li>
<li>Divide the input array into 4-byte blocks.</li>
<li>Calculate the exclusive-or of all blocks as the hash output. </li>
</ol>

<p>I have completed points a and b but I am stuck on c. I am unsure as where to go now. Here is my code so far:</p>

<pre><code>public class HomeWork {
    public static String file = "HW2P1input";

    public static void main(String[] args) throws IOException {
        Path path = Paths.get(file);
        byte[] source = Files.readAllBytes(path);
        byte newB[][] = divideArray(source,4);
    }

    public static byte[][] divideArray(byte[] source, int chunksize) {

        byte[][] ret = new byte[(int)Math.ceil(source.length / (double)chunksize)][chunksize];

        int start = 0;

        for(int i = 0; i &lt; ret.length; i++) {
            if(start + chunksize &gt; source.length) {
                System.arraycopy(source, start, ret[i], 0, source.length - start);
            } else {
                System.arraycopy(source, start, ret[i], 0, chunksize);
            }
            start += chunksize ;
        }
        return ret;
    }
}
</code></pre>

<p>I understand that ^ is the exclusive-or operator, however I do not understand how to use it when I only have one byte array.</p>