Fixed xor_key not iterating correctly when dir = 0