There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

Redkey , (edited )

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:


<span style="color:#323232;">long main () {
</span><span style="color:#323232;">    char output;
</span><span style="color:#323232;">    unsigned char shift;
</span><span style="color:#323232;">    long temp;
</span><span style="color:#323232;">    
</span><span style="color:#323232;">    if (i < 152) {
</span><span style="color:#323232;">        shift = (~i & 1) * 7;
</span><span style="color:#323232;">        temp = b[i >> 1] >> shift;
</span><span style="color:#323232;">        i++;
</span><span style="color:#323232;">        output = (char)(64 & temp);
</span><span style="color:#323232;">        output += (char)((n >> (temp & 63)) & main());
</span><span style="color:#323232;">        printf("%c", output);
</span><span style="color:#323232;">    }
</span><span style="color:#323232;">
</span><span style="color:#323232;">    return 63;
</span><span style="color:#323232;">}
</span>

EDIT: I just got a chance to compile it and it does work.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines