▲ | praptak 2 days ago | |||||||
Fun fact: the xor swap fails when the variables are aliases. This was the trick used in one of the underhanded code competitions. Basically xor swapping a[i] with a[j] triggered the evil logic when i was equal to j. | ||||||||
▲ | CodesInChaos 2 days ago | parent | next [-] | |||||||
The submission by David Wagner, Philipe Biondi at https://bingweb.binghamton.edu/~scraver/underhanded/_page_id... The state of RC4 consists of a random permutation of bytes. Whenever it outputs a value, it further permutes the state by swapping some bytes of the state. Th xor swap trick sets one of these values to zero, whenever RC4 attempts to swap the same item within the permutation. This gradually zeros out the state, until RC4 outputs the plaintext. | ||||||||
▲ | vaylian 2 days ago | parent | prev [-] | |||||||
It would set a[i] to zero instead of swapping two values, right? | ||||||||
|