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

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

Description

xor Byte Arrays

License

Apache License

Declaration

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

Method Source Code

//package com.java2s;
/**/*  w ww  .j  a  v a 2 s .c  o  m*/
 * Copyright 2014 TheBigS (github.com/TheBigS)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    public static byte[] xorByteArrays(byte[] a, byte[] b) {
        byte[] c = new byte[a.length];
        for (int i = 0; i < a.length; i++) {
            c[i] = (byte) (a[i] ^ b[i]);
        }
        return c;
    }
}

Related

  1. xorArrayBytes(byte[] operador1, byte[] operador2)
  2. xorArrays(byte[] a, byte[] b)
  3. xorArrays(byte[] a, byte[] b)
  4. xorArrays(byte[] src, byte xor, byte xor_s, byte xor_e)
  5. xorBlock(byte[] a, int aOff, byte[] b, int bOff, byte[] dst, int dstOff, int len)
  6. xorByteArrays(byte[] first, byte[] second)
  7. xorBytes(byte[] data, byte[] key)
  8. xorData(final byte[] data, final byte[] passBytes)
  9. xorDecode(byte[] str, char[] key)