110 may 2008 | LINUX For yoU | www.
openITis.
com
I
n March 2007, we covered the basics of code
obfuscation.
For those who missed reading it,
obfuscation is, “The art of concealing the meaning of
communication by making it more confusing and harder
to...
More
110 may 2008 | LINUX For yoU | www.
openITis.
com
I
n March 2007, we covered the basics of code
obfuscation.
For those who missed reading it,
obfuscation is, “The art of concealing the meaning of
communication by making it more confusing and harder
to interpret.
” Here is an obfuscated (almost) one-line
program.
Can you decipher it and find out what it does?
main(int c,char**v){c=0;int n,i=(strlen(v[1])1);while(i>=0){n=v[1][i]-’0’;if(!(i%2))n=(n>4)?(n*2%10)+1:
n*2;c+=n;i--;}return((c%10)==0);}
Okay, it is difficult, so let me help you and explain
what it does.
This program checks if your credit card
number is valid or not! No, I am not kidding, it is true;
just give your credit card number as the argument to the
executable and if it returns 1, the given number is valid,
else it isn’t.
Assume that the file name of the program
is obfus.
oneline.
c.
Compile it using your favourite C
compiler.
Run it and give your credit card number as the
argument.
If the program returns 1, the car
Less