spectere.net

The Chatterbox => Computing => Topic started by: annon on March 23, 2010, 07:43:22 PM

Title: Obfuscation
Post by: annon 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
Title: Re: Obfuscation
Post by: Kulli 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?
Title: Re: Obfuscation
Post by: annon 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)));}
Title: Re: Obfuscation
Post by: Bobbias 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).
Title: Re: Obfuscation
Post by: annon 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);}
Title: Re: Obfuscation
Post by: Bobbias on April 23, 2010, 11:57:51 AM
Nice work. lol: char*s="Pie!"
Title: Re: Obfuscation
Post by: annon 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)))));}