Java xor xor(byte[] first, byte[] second)

Here you can find the source of xor(byte[] first, byte[] second)

Description

xor

License

Open Source License

Declaration

public static byte[] xor(byte[] first, byte[] second) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static byte[] xor(byte[] first, byte[] second) throws Exception {
        if (first.length != second.length)
            throw new Exception("Arguments have different lengths");

        byte[] output = new byte[first.length];

        for (int i = 0; i < first.length; i++) {
            output[i] = (byte) (first[i] ^ second[i]);
        }/*from   w  w  w  .j ava2 s.c om*/

        return output;
    }
}

Related

  1. xor(byte[] block, byte[] val)
  2. xor(byte[] block, byte[] val)
  3. xor(byte[] bytes, int offset, byte[] bytesToMix, int mixOffset, int len)
  4. xor(byte[] bytes1, byte[] bytes2)
  5. xor(byte[] data, byte[] xork)
  6. xor(byte[] firstBytes, int firstOffset, byte[] secondBytes, int secondOffset, byte[] outBytes, int outOffset, int size)
  7. xor(byte[] op1, byte[] op2)
  8. xor(byte[] source, byte[] key)
  9. xor(byte[] x, byte[] y)