If your love letter isn't given in the form of highly obfuscated C, is it really a love letter?
I don't know, but what I do know is that I love you! <3
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:
If anyone wants to actually run this, here ya go:
#include <stdio.h> short i=0;long b[]={1712,6400 ,3668,14961,00116, 13172,10368,41600, 12764,9443,112,12544,15092,11219,116,8576,8832 ,12764,9461,99,10823,17,15092,11219,99,6103,14915, 69,1721,10190,12771,10065,16462,13172,10368,11776, 14545,10460,10063,99,12544,14434,16401,16000,8654, 12764,13680,10848,9204,113,10441,14306,9344,12404, 32869,42996,12288,141129,12672,11234,87,10086, 12655,99,22487,14434,79,10083,12750,10368, 10086,14929,79,10868,14464,12357};long n=9147811012615426336;long main(){ if(i<0230)printf("%c",(char)(( 0100&b[i++>>1]>>(i--&0x1)* 007)+((n>>(b[i>>001]>> 7*(0b1&01-i++)))&1 *main(111)))); return 69- 0b0110 ;}
Bonus points if you can deobfuscate it!
If your love letter isn't given in the form of highly obfuscated C, is it really a love letter? I don't know, but what I do know is that I love you! <3
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.