Android Byte Array XOR xor(byte[] dest, byte[] bytesToMix)

Here you can find the source of xor(byte[] dest, byte[] bytesToMix)

Description

xor

License

Apache License

Declaration

public static void xor(byte[] dest, byte[] bytesToMix) 

Method Source Code

//package com.java2s;
/**/*  w w w  .  jav a  2  s . c  o  m*/
 * Source obtained from crypto-gwt. Apache 2 License.
 * https://code.google.com/p/crypto-gwt/source/browse/crypto-gwt/src/main/java/com/googlecode/
 * cryptogwt/util/ByteArrayUtils.java
 */

public class Main {
    public static void xor(byte[] bytes, int offset, byte[] bytesToMix,
            int mixOffset, int len) {
        int bytesLength = offset + len;
        for (; offset < bytesLength; offset++) {
            bytes[offset] ^= bytesToMix[mixOffset++];
        }
    }

    public static void xor(byte[] dest, byte[] bytesToMix) {
        assert dest.length == bytesToMix.length : "different lengths: "
                + dest.length + " != " + bytesToMix.length;
        xor(dest, 0, bytesToMix, 0, dest.length);
    }
}

Related

  1. xor(byte[] b1, byte[] b2)
  2. xorFor16(byte[] b1, byte[] b2)
  3. xor(byte[] bytes, int offset, byte[] bytesToMix, int mixOffset, int len)
  4. xor(byte[] data1, byte[] data2)