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:
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!
float m[] = {2.94576846098867283087373218349056E+32, 3.761396E+24, 9.316795E-39 };
main(){printf(m);}
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!
This comment has been removed by the author.
ReplyDeleteHere is a code which generates this kind of program.....All u need to do is change d string hardcoded :)
ReplyDelete#include<stdio.h>
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[] = {");
for(i=0;i<c;i++)
printf("%1.32E,",p[i]);
printf("\b};\nmain(){printf(m);}");
return 0;
}
@Mrinal: Hats off to you man!
ReplyDeleteYou are the winner. :)
@readers... Intro for Mrinal: He is in IIT-Kanpur and refused a job in TCS to pursue his higher studies...
Not really....i got job in Infosys :)
ReplyDeleteSo, what did the winner get ?? a date with you ??
ReplyDelete