public static byte [ ] xorBytes ( byte [ ] data , byte [ ] key ) { byte [ ] xored = new byte [ data . length ] ; for ( int ii = 0 ; ii < data . length ; ii ++ ) { xored [ ii ] = ( byte ) ( data [ ii ] ^ key [ ii % key . length ] ) ; } return xored ; }
XORs a byte array against a key .