LostXOR@fedia.io to Programmer Humor@programming.dev · 3 months agoThe best love letters are written in C (apologies to the Rust fans)fedia.ioexternal-linkmessage-square15fedilinkarrow-up116arrow-down10
arrow-up116arrow-down1external-linkThe best love letters are written in C (apologies to the Rust fans)fedia.ioLostXOR@fedia.io to Programmer Humor@programming.dev · 3 months agomessage-square15fedilink
minus-squareRedkey@programming.devlinkfedilinkarrow-up1·edit-23 months agoI 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; }
minus-squareulterno@lemmy.kde.sociallinkfedilinkEnglisharrow-up2·3 months agoHere’s it with some amount of de-obfuscation: #include <stdio.h> short i = 0; const long b[] = { 0xd60, 0x3200, 0x1ca8, 0x74e2, 0x9c, 0x66e8, 0x5100, 0x14500, 0x63b8, 0x49c6, 0xe0, 0x6200, 0x75e8, 0x57a6, 0xe8, 0x4300, 0x4500, 0x63b8, 0x49ea, 0xc6, 0x548e, 0x22, 0x75e8, 0x57a6, 0xc6, 0x2fae, 0x7486, 0x8a, 0xd72, 0x4f9c, 0x63c6, 0x4ea2, 0x809c, 0x66e8, 0x5100, 0x5c00, 0x71a2, 0x51b8, 0x4e9e, 0xc6, 0x6200, 0x70c4, 0x8022, 0x7d00, 0x439c, 0x63b8, 0x6ae0, 0x54c0, 0x47e8, 0xe2, 0x5192, 0x6fc4, 0x4900, 0x60e8, 0x100ca, 0x14fe8, 0x6000, 0x44e92, 0x6300, 0x57c4, 0xae, 0x4ecc, 0x62de, 0xc6, 0xafae, 0x70c4, 0x9e, 0x4ec6, 0x639c, 0x5100, 0x4ecc, 0x74a2, 0x9e, 0x54e8, 0x7100, 0x608a }; const long n = 9147811012615426336; long main () { if (i < 152) { char shifter; if (i % 2 == 0) { shifter = 8; } else { shifter = 1; } char adder1 = (b[i >> 1] >> shifter) & 64; char adder2 = (n >> (b[i >> 1] >> shifter)) & 63; char to_print = (char)adder1 + adder2; i++; main (); printf ("%c", to_print); } return 63; } Needless to say, the return value doesn’t matter any more. So you can change it to 0 or 69 depending upon your preferences.
minus-squareulterno@lemmy.kde.sociallinkfedilinkEnglisharrow-up2·3 months agoAnd more de-obf: #include <stdio.h> const char addarr1[] = { 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x0, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x0, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x0, 0x0, 0x40, 0x0, 0x40, 0x40, 0x40, 0x0, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x0, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x0, 0x40, 0x40, 0x40, 0x40, 0x0, 0x40, 0x40, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0 }; const char addarr2[] = { 0x9, 0x26, 0x20, 0x39, 0x2f, 0x35, 0x32, 0x20, 0x2c, 0x2f, 0x36, 0x25, 0x20, 0x2c, 0x25, 0x34, 0x34, 0x25, 0x32, 0x20, 0x29, 0x33, 0x2e, 0x27, 0x34, 0x20, 0x27, 0x29, 0x36, 0x25, 0x2e, 0x20, 0x29, 0x2e, 0x20, 0x34, 0x28, 0x25, 0x20, 0x26, 0x2f, 0x32, 0x2d, 0x20, 0x2f, 0x26, 0x20, 0x28, 0x29, 0x27, 0x28, 0x2c, 0x39, 0x20, 0x2f, 0x22, 0x26, 0x35, 0x33, 0x23, 0x21, 0x34, 0x25, 0x24, 0x20, 0x3, 0x2c, 0x20, 0x29, 0x33, 0x20, 0x29, 0x34, 0x20, 0x32, 0x25, 0x21, 0x2c, 0x2c, 0x39, 0x20, 0x21, 0x20, 0x2c, 0x2f, 0x36, 0x25, 0x20, 0x2c, 0x25, 0x34, 0x34, 0x25, 0x32, 0x3f, 0xa, 0x9, 0x20, 0x24, 0x2f, 0x2e, 0x27, 0x34, 0x20, 0x2b, 0x2e, 0x2f, 0x37, 0x2c, 0x20, 0x22, 0x35, 0x34, 0x20, 0x37, 0x28, 0x21, 0x34, 0x20, 0x9, 0x20, 0x24, 0x2f, 0x20, 0x2b, 0x2e, 0x2f, 0x37, 0x20, 0x29, 0x33, 0x20, 0x34, 0x28, 0x21, 0x34, 0x20, 0x9, 0x20, 0x2c, 0x2f, 0x36, 0x25, 0x20, 0x39, 0x2f, 0x35, 0x21, 0x20, 0x3c, 0x33, 0xa }; int main () { for (int i = 0; i < 152; i++) { char adder1 = addarr1[i]; char adder2 = addarr2[i]; char to_print = (char)adder1 + adder2; printf ("%c", to_print); } return 63; } 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.
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.