Here you can find the source of xor(byte data[], byte key[])
public static byte[] xor(byte data[], byte key[])
//package com.java2s; /* ======================================================================== * PlantUML : a free UML diagram generator * ======================================================================== * * (C) Copyright 2009-2017, Arnaud Roques * * Project Info: http://plantuml.com// w ww . j a v a 2 s . co m * * This file is part of PlantUML. * * 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. * * * Original Author: Arnaud Roques */ public class Main { public static byte[] xor(byte data[], byte key[]) { final byte[] result = new byte[data.length]; int pos = 0; for (int i = 0; i < result.length; i++) { result[i] = (byte) (data[i] ^ key[pos++]); if (pos == key.length) { pos = 0; } } return result; } }