Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
Whoops! When I looked at the second time that the shift value is calculated, I wondered if it would be inverted from the first time, but for some reason I decided that it wouldn’t be. But looking at it again it’s clear now that (1 - i) = (-i + 1) = ((~i + 1) + 1), making bit 0 the inverse. Then I wondered why there wasn’t more corruption and realized that the author’s compiler must perform postfix increments and decrements immediately after the variable is used, so the initial shift is also inverted. That’s why the character pairs are flipped, but they still decode correctly otherwise. I hope this version works better:
I don’t know if this will work or even compile, but I feel like I’m pretty close.
long main () { char output; unsigned char shift; long temp; if (i < 152) { shift = (i & 1) * 7; temp = b[i >> 1] >> shift; i++; output = (char)(64 & temp); output += (char)((n >> (temp & 63)) & main()); printf("%c", output); } return 63; }
Here’s it with some amount of de-obfuscation:
Needless to say, the return value doesn’t matter any more. So you can change it to
0
or69
depending upon your preferences.And more de-obf:
I guess I should have kept the recursion and straightened it out in the next step, but now that it’s done…
The next step will just have an array of the characters that would be printed, so I’ll leave it here.
Some kind of Caesar cipher you made?
Whoops! When I looked at the second time that the shift value is calculated, I wondered if it would be inverted from the first time, but for some reason I decided that it wouldn’t be. But looking at it again it’s clear now that (1 - i) = (-i + 1) = ((~i + 1) + 1), making bit 0 the inverse. Then I wondered why there wasn’t more corruption and realized that the author’s compiler must perform postfix increments and decrements immediately after the variable is used, so the initial shift is also inverted. That’s why the character pairs are flipped, but they still decode correctly otherwise. I hope this version works better:
long main () { char output; unsigned char shift; long temp; if (i < 152) { shift = (~i & 1) * 7; temp = b[i >> 1] >> shift; i++; output = (char)(64 & temp); output += (char)((n >> (temp & 63)) & main()); printf("%c", output); } return 63; }
EDIT: I just got a chance to compile it and it does work.