Author Topic: Obfuscation  (Read 4636 times)

annon

  • AWSUM MODERATAR!!!!1
  • Hero Member
  • *****
  • Posts: 1837
    • View Profile
Obfuscation
« on: March 23, 2010, 07:43:22 PM »
I tried writing an obfuscated C program today after seeing a lot of much cooler obfuscated programs. It was a lot of fun to write.

Code: [Select]
\
#\
in\
clu\
de<s\
tdio.\
h>////
int m\
ain(){\
char fo\
o,*_="/)\
:e`=HKl]D\
pm>oa[o^`t\
,>luW_!\x20\
#lf\n[rvdb!'\
Wc";for(foo='\
\x1';foo<'\xe'\
;foo+=('\15')/'\
\xd')printf("%c"\
,*(_+=((*_)-(*(_+\
'\xf'/'\17')))));}

I want to learn a lot more C so I can do/understand some of the stuff I see in competitions.

So yeah, anyone else a fan of obfuscation?

EDIT: Suppose I should post links.

http://en.wikipedia.org/wiki/Obfuscated_code
http://www.ioccc.org/years.html
« Last Edit: March 23, 2010, 08:27:21 PM by annon »

Code: [Select]
f(u,c,k,_,y,e,a,h)
{return u*u*u*u-u*u*u*_+u*u*y-u*e+a?k?f(u+1,c,k-1,_,y,e,a,h):0:putchar(u-c+h)==f(u+1,u,k-1,_,y,e,a,h);}
main(){return f(0,0,34,84,2423,26628,72864,98)<putchar(32)>f(0,0,40,125,5809,118995,906750,96)==~putchar(10);}

Kulli

  • Guest
Re: Obfuscation
« Reply #1 on: March 23, 2010, 08:47:12 PM »
I don't code, but I like the way obfuscation looks.

What is your program supposed to do?

annon

  • AWSUM MODERATAR!!!!1
  • Hero Member
  • *****
  • Posts: 1837
    • View Profile
Re: Obfuscation
« Reply #2 on: March 23, 2010, 09:19:54 PM »
It prints "Hello World!"

Here's a better version that doesn't have any whitespace (save for newlines), but might not compile since I didn't import stdio.h.
Code: [Select]
\
m\
ai\
n()\
{cha\
r*_="\
/):e`=\
HKl]Dpm\
>oa[o^`t\
,>luW_!\x\
20#lf\n[rv\
db!'Wc";whi\
le(*_)printf\
("%c",*(_+=*_\
-*(_+1)));}
« Last Edit: March 23, 2010, 09:33:42 PM by annon »

Code: [Select]
f(u,c,k,_,y,e,a,h)
{return u*u*u*u-u*u*u*_+u*u*y-u*e+a?k?f(u+1,c,k-1,_,y,e,a,h):0:putchar(u-c+h)==f(u+1,u,k-1,_,y,e,a,h);}
main(){return f(0,0,34,84,2423,26628,72864,98)<putchar(32)>f(0,0,40,125,5809,118995,906750,96)==~putchar(10);}

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Obfuscation
« Reply #3 on: March 23, 2010, 11:10:30 PM »
Obfuscated code is always fun. It amazes me some of the weird stuff people take advantage of to obfuscate their code. Of course, I'm more fascinated by stuff involving making cracking/reverse engineering/detection and such harder. It's amazing the lengths that people will go to to ensure that their program is harder to hack/decompile/be located by detectors (viruses and the like are generally in the latter part of those).
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

annon

  • AWSUM MODERATAR!!!!1
  • Hero Member
  • *****
  • Posts: 1837
    • View Profile
Re: Obfuscation
« Reply #4 on: April 23, 2010, 01:05:51 AM »
I made another one. This one calculates pi to 7 digits.
Code: [Select]
#define foo (double)(k+1)*(k+1)
      
      main(){
   int i;double
 j;char*s="Pie!";
double pi=2;int k=
1;while(*s )k*=*(s
++);k++;while(k=~-
  k--)pi*=(foo)/
     (foo-1);

printf("%1.7f\n", pi);}
« Last Edit: April 23, 2010, 01:10:59 AM by annon »

Code: [Select]
f(u,c,k,_,y,e,a,h)
{return u*u*u*u-u*u*u*_+u*u*y-u*e+a?k?f(u+1,c,k-1,_,y,e,a,h):0:putchar(u-c+h)==f(u+1,u,k-1,_,y,e,a,h);}
main(){return f(0,0,34,84,2423,26628,72864,98)<putchar(32)>f(0,0,40,125,5809,118995,906750,96)==~putchar(10);}

Bobbias

  • #1 Poster
  • Hero Member
  • *****
  • Posts: 7210
  • 404 Avatar not found.
    • View Profile
    • Magnetic Architect
Re: Obfuscation
« Reply #5 on: April 23, 2010, 11:57:51 AM »
Nice work. lol: char*s="Pie!"
This is going in my sig. :)

BANNED FOR BAD PUNS X_x

annon

  • AWSUM MODERATAR!!!!1
  • Hero Member
  • *****
  • Posts: 1837
    • View Profile
Re: Obfuscation
« Reply #6 on: September 17, 2010, 03:10:23 AM »
Oh hey guys.
Code: [Select]
              d(e,l,t,a)
             {/***/return
            e-l?    putchar
           (l%(      (t^a)<<
          (e/a        ))?l/((
         t^a)          <<(e/a)
        )+-(            abs(((t
       ^a)<<             (t/a))\
      -l%(                (t^a)<<
     (e/a                  ))))&&l
    /((t                    ^a)<<(e
   /a))                      -(t^a)-
  (e/a)                       ?a:t:((
 t^a)<<(e/a))+~(t^a)|(e/a)),d(e,l+t/a,
t,a):/***************************/a/t;}
main(void){return((((d(73,1,35,32)))));}
« Last Edit: September 17, 2010, 03:15:07 AM by annon »

Code: [Select]
f(u,c,k,_,y,e,a,h)
{return u*u*u*u-u*u*u*_+u*u*y-u*e+a?k?f(u+1,c,k-1,_,y,e,a,h):0:putchar(u-c+h)==f(u+1,u,k-1,_,y,e,a,h);}
main(){return f(0,0,34,84,2423,26628,72864,98)<putchar(32)>f(0,0,40,125,5809,118995,906750,96)==~putchar(10);}