Last active
August 29, 2015 14:25
-
-
Save arkku/bf65447fdd035934cf79 to your computer and use it in GitHub Desktop.
ROR puzzle
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint32_t ror(const uint32_t w, const unsigned rot) { // ROtate Right (bits move `rot` places right w/ wraparound) | |
return (w >> rot) | (w << (32 - rot)); | |
} | |
uint32_t a; // = ? | |
uint32_t rotation = 13; | |
uint32_t b = 0x29d34b82; | |
// b == a ^ ror(a, rotation) | |
// What is `a` when `b` was formed by `a ^ ror(a, rotation)`? There is more than one correct answer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
^
is the bitwise XOR operator, the functionror
rotates bits to the right.