Java Array xor xorDecode(byte[] str, char[] key)

Here you can find the source of xorDecode(byte[] str, char[] key)

Description

xor Decode

License

Open Source License

Declaration

public static byte[] xorDecode(byte[] str, char[] key) 

Method Source Code

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

public class Main {

    public static byte[] xorDecode(byte[] str, char[] key) {
        byte[] buf = new byte[str.length];
        for (int i = 0, j = 0; j < str.length; j++) {
            if (i >= 8)
                i = 0;/*from w  w  w  .  ja  va2s .c om*/
            buf[j] = (byte) ((char) str[j] ^ (char) key[i]);
            i++;
        }

        return buf;
    }
}

Related

  1. xorBlock(byte[] a, int aOff, byte[] b, int bOff, byte[] dst, int dstOff, int len)
  2. xorByteArrays(byte[] a, byte[] b)
  3. xorByteArrays(byte[] first, byte[] second)
  4. xorBytes(byte[] data, byte[] key)
  5. xorData(final byte[] data, final byte[] passBytes)
  6. xorend(byte[] in1, byte[] in2)
  7. xorI(long[] v, long[] o)
  8. xorTwoByteArrays(byte[] byteArray1, byte[] byteArray2)