Running a block of code on every interval except the first iteration
Initialize the first byte, and then start the loop from 1.....

You may also want to do a bit-check instead of modulo, but they may be equally fast...

if (dataSize &gt; 0) {
    data[0] ^= key;
}
for (int i = 1; i &lt; dataSize; i++) {

   // Increase the key as per the algorithm
   if (i &amp; 3 == 0) {
      key *= 13
   }

   // Shift over i bytes, as per the algorithm
   data[i] ^= key &gt;&gt; (8 * (i % 4));
}


EDIT:

I have seen the following done (translating from memory of a C program)... this has been known to be able to compile down to SIMD-using instructions on supporting compilers, etc.

for (int i = 0; i &lt; dataSize - 3; i+=4) {

   // Shift over i bytes, as per the algorithm
   data[i + 0] ^= key; // &gt;&gt; (   0);
   data[i + 1] ^= key &gt;&gt; (   8);
   data[i + 2] ^= key &gt;&gt; (  16);
   data[i + 3] ^= key &gt;&gt; (  24);

   key *= 13

}

// handle up to 3 remaining bytes.....
for (int i = dataSize - (dataSize &amp; 3); i &lt; dataSize; i++) {
    data[i] ^= key &gt;&gt; (8 * (i &amp; 3));
}