If this blog helped you in any way, please donate a dollar here

Thursday, September 23, 2010

Obfuscated Code Contest

Obfuscation is an art. It refers to making your code hard to read... hard to understand using advanced concepts. So, let me present a code that prints my name, but in an obfuscated manner! This was done by me a couple of years ago, but was faulty. I corrected it and here it is:

float m[] = {2.94576846098867283087373218349056E+32, 3.761396E+24, 9.316795E-39 };

Magic eh? Nope... just an understanding of data types.

The concept here is pretty simple. Data representation is exploited. Don't think IEEE754 here, since this can be made with a simpler technique. So.. let me ask my readers... what technique can be used to generate the number?

I am giving away a prize for the person who answers this first and correctly. Best of Luck!


  1. This comment has been removed by the author.

  2. Here is a code which generates this kind of program.....All u need to do is change d string hardcoded :)

    typedef float type;

    /*as this trick works for other data type also...u can use nything...just change printf parameter acordingly :)*/

    int main()
    char s[]="Mrinalkanti Ghosh";
    type * p=(type *)s;
    int i;
    int c=sizeof(s)/((float)sizeof(type))+.5;
    /*to avoid integer division*/
    printf("float m[] = {");
    return 0;

  3. @Mrinal: Hats off to you man!

    You are the winner. :)

    @readers... Intro for Mrinal: He is in IIT-Kanpur and refused a job in TCS to pursue his higher studies...

  4. Not really....i got job in Infosys :)

  5. So, what did the winner get ?? a date with you ??