xor_data function can be optimized if key is 0 the data will be the same so just return the data instead of iterating through it.