Java xor xor(byte[] a, byte[] b)

Here you can find the source of xor(byte[] a, byte[] b)

Description

xor

License

Mozilla Public License

Declaration

public static byte[] xor(byte[] a, byte[] b) 

Method Source Code

//package com.java2s;
//License from project: Mozilla Public License 

public class Main {
    public static byte[] xor(byte[] a, byte[] b) {
        if (a.length != b.length) {
            throw new IllegalArgumentException("Arrays a and b should have equal length");
        }//from w  w  w .jav a2  s. com
        byte[] result = new byte[a.length];
        for (int i = 0; i < a.length; i++) {
            result[i] = (byte) (a[i] ^ b[i]);
        }
        return result;
    }
}

Related

  1. xor(boolean[] array)
  2. xor(boolean[][] b1, boolean[][] b2)
  3. xor(byte abyte0[])
  4. xor(byte data[], byte key[])
  5. xor(byte lhs[], byte rhs[])
  6. xor(byte[] a, byte[] b)
  7. xor(byte[] a, byte[] b)
  8. xor(byte[] a, byte[] b)
  9. xor(byte[] a, byte[] b)