3 ms·
It's a nice xor swap, but I think you reversed your list twice. And xor swapping with x=y=2 is likely not ideal. Seems like exactly what I'd do in an interview
by allenlavoie 9y ago
It's a nice xor swap, but I think you reversed your list twice. And xor swapping with x=y=2 is likely not ideal. Seems like exactly what I'd do in an interview too :p
- CodesInChaos 9y agoThe xor swap failure when working on the same variable has been nicely exploited in the underhanded C contest: http://www.underhanded-c.org/_page_id_16.html http://www.underhanded-c.org/_page_id_16.html > The XOR-swap trick is an example of coders being too clever for their own good. Here, it gradually poisons the RC4 permutation with zeroes, until eventually the plaintext is just passed along in the clear.
- 0xfeba 9y agoHa! Those are always good reads. Thanks.
- 0xfeba 9y agoSee, I'd need to run and debug it to figure all that out. But apparently some people can just write it all out on a whiteboard in one go.