public void processBytes(byte[] in, int inOff, int len, byte[] out, int outOff)
    {
        if((inOff + len) > in.length)
        {
            throw new RuntimeException("output buffer too short");
        }
        if((outOff + len) > out.length)
        {
            throw new RuntimeException("out put buffer too short");
        }
        for(int i = 0; i < len; i++)
        {
            x = (x + 1) & 0xff;
            y = (engineState[x] + y) & 0xff;
            //swap
            byte tmp = engineState[x];
            engineState[x] = engineState[y];
            engineState[y] = tmp;
            //xor
            out[i + outOff] = (byte) (in[i + inOff] ^ engineState[(engineState[x] + engineState[y]) & 0xff]);
        }

    }