Created
January 14, 2012 15:46
-
-
Save jotaki/1611836 to your computer and use it in GitHub Desktop.
Obfuscated Hello, World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* compile with gcc -o obfhello obfhello.c -lm */ | |
#define xR return | |
# define T typedef | |
# define E extern | |
# define S static | |
# define P putchar | |
# define Z ((V*)0) | |
#define Bb main | |
# define X int | |
# define A char | |
# define H void | |
# define Q sqrt | |
# define G double | |
#define U 3 | |
T X Y;T A C;T C** O;T H V;T G D;E D Q(D x);E Y P(Y c);S Y (*o)(Y c)=P;S D | |
(*f)(D x)=Q;S Y s_(M)Y M;{xR(Bb(M,Z));}S Y _[]={(9*31+22)*10+56*2+14,(((U*15+72) | |
-1)/2+17)*1.4-5,12*U,1*100+9*11-U,(0x2357*2.3-72.1)*-1,-((1<<9)+(1<<U)*34),(1<< | |
13)+(125<<U)+(U*8),32767>>5^2047,((4*16<<1)-(9*2))*U+70,-1024,-(66*10+16),-24* | |
1000-(900+(1<<6)),-3136,(2*256)^-768,225*4};Y Bb(I,v)Y I;O v;{S Y _0=0;xR(v!=Z? | |
s_(0110):(0<I)?o(I),s_((_0+=1,I+((((0>(_0-1)[_])?-1*(Y)f(-((_0-1)[_])):(Y)f( | |
(_0-1)[_]))>>1)^_0))):0);} |
iank
commented
Jan 14, 2012
static int buf[]={
3136,100,36,196,-20736,-784,9216,1024,400,-1024,-676,-24964,-3136,-256,900
};
static int idx=0;
int main(int I, char **v) {
int sign,n,p;
if (v!=0)
return main(72,0);
if (I <= 0) return;
putchar(I);
n = buf[idx++];
sign = n/abs(n);
p = sign * sqrt(abs(n));
p = (p >> 1) ^ idx;
main(I+p,0);
}
static int buf[]={
3136,100,36,196,-20736,-784,9216,1024,400,-1024,-676,-24964,-3136,-256
};
static char c = 'H';
int main() {
int sign,n,p,i;
for (i = 0; i < 14; i++) {
n = buf[i]; sign = n/abs(n);
p = sign * sqrt(abs(n));
p = (p >> 1) ^ (i+1);
putchar(c);
c += p;
}
}
char *str = "Hello, World!\n";
static int off[14];
int main() {
int sign,p,i;
for (i = 1; i <= strlen(str); i++) {
p = str[i] - str[i-1];
sign = p == 0 ? 1 : p/abs(p);
p ^= (i);
p = (p << 1);
p = sign * p*p;
off[i-1] = p;
}
int n;
char c = str[0];
for (i = 0; i < strlen(str); i++) {
n = off[i]; sign = n/abs(n);
p = sign * sqrt(abs(n));
p = (p >> 1) ^ (i+1);
putchar(c);
c += p;
}
}
static int off[]={
'e' - 'H',
'l' - 'e',
'l' - 'l',
'o' - 'l',
',' - 'o',
' ' - ',',
'W' - ' ',
'o' - 'W',
'r' - 'o',
'l' - 'r',
'd' - 'l',
'!' - 'd',
'\n' - '!',
};
static char c = 'H';
int main() {
int i;
for (i = 0; i < 14; i++) {
putchar(c); c += off[i];
}
}
static char *str = "Hello, World!\n";
int main() {
int i;
for (i = 0; i < strlen(str); i++) {
putchar(str[i]);
}
}
int main() {
puts("Hello, World!");
}
Q.E.D.
iank wins! \o/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment