Java xor xor(byte[] b1, byte[] b2)

Here you can find the source of xor(byte[] b1, byte[] b2)

Description

xor

License

GNU General Public License

Declaration

public static byte[] xor(byte[] b1, byte[] b2) 

Method Source Code

//package com.java2s;
/* This code is part of Freenet. It is distributed under the GNU General
 * Public License, version 2 (or at your option any later version). See
 * http://www.gnu.org/ for further details of the GPL. */

public class Main {
    public static byte[] xor(byte[] b1, byte[] b2) {
        int maxl = Math.max(b1.length, b2.length);
        byte[] rv = new byte[maxl];

        int minl = Math.min(b1.length, b2.length);
        for (int i = 0; i < minl; i++)
            rv[i] = (byte) (b1[i] ^ b2[i]);
        return rv;
    }/*from   www  . ja  va  2  s.  c o  m*/
}

Related

  1. xor(byte[] a, byte[] b)
  2. xor(byte[] a, int offsetA, byte[] b, int offsetB, byte[] dst, int dstOffset, int length)
  3. xor(byte[] aBuffer, int aOffset, int aLength, byte[] aMask, int aMaskOffset)
  4. xor(byte[] array1, byte[] array2)
  5. XOR(byte[] array1, byte[] array2)
  6. xor(byte[] b1, byte[] b2)
  7. xor(byte[] block, byte[] val)
  8. xor(byte[] block, byte[] val)
  9. xor(byte[] bytes, int offset, byte[] bytesToMix, int mixOffset, int len)