7 ms·
Stolen from 4chan. Not malicious, just prints out a string, but in terms of code density is simultaneously some of the smartest and dumbest code I've ever seen.
by thunderbird120 4y ago
Stolen from 4chan. Not malicious, just prints out a string, but in terms of code density is simultaneously some of the smartest and dumbest code I've ever seen. Bonus points if you can actually figure out exactly how it works.
#include <stdint.h>
#include <stdio.h>
int main()
{
//the following code should be self-explanatory
int format = 684837;
uint64_t freqs[16] = {4557704611105873944,6293041952211349568,7232032755832676440,9836271091686599272,11342418091143829394,7666925796986299039,8289648};
uint64_t phases[16] = {2745812699376323861,4477710776532278558,4107622644641439798,4062343665106426382,4257685111635071841,2598073413584315427,1713226};
uint64_t composite[32] = {0};
int i = 0;
unsigned char frequency = i[(char*)(freqs)];
unsigned char phase = i[(char*)(phases)];
while (frequency > 0){
for (int j=phase;j<2048;j+=frequency){
(j/64)[composite] |= ((uint64_t)1 << j%64);
}
frequency = (i%64)[(char*)(freqs+i/64)];
phase = (i%64)[(char*)(phases+i/64)];
i++;
}
printf((char*)&format, composite);
return 0;
}
- pfoof 4y agoa completely blind guess: FFT with encoded "hello world"?
- thunderbird120 4y agoNot exactly, what's happening is vaguely fourier-like but I'm not even sure there's an actual name for what it's doing.