![]() |
|
Programming C, bash, Python, Perl, PHP, Java, you name it. |
![]() |
|
Thread Tools | Display Modes |
|
|||
![]()
This is my first exercise in code obfuscation. This is a legal C program and will compile (tested gcc and pcc) -- I'll let you guess what it does before I tell you (don't cheat by running it).
Code:
_(__,___,____,_____){(__)?printf("%d\n",____),_(__-_____,____,___+____,_____):0;}main(){_(25,0,1,1);}
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
![]()
I don't know what's more evil, that I can actually read that fine or that you actually compiled it.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
|||
![]() Quote:
Three cheers for ephemera! ![]()
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
|||
![]()
So, how did I do on my first attempt at obfuscation? Was it hard to understand? easy to decipher? etc.?
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
![]()
Interesting, no, and yes, lol.
All I had to do, was count the underscores to find which identifiers were which, as soon as I spotted the recursive call (~3 seconds later) it was obvious that displays a sequence of 25 numbers. The only 'hard' part was double checking if the sequence were fibonacci numbers, if you call that hard. (I stopped thinking after mentally compiling '5'). Maybe try writing a java virtual machine in brainfuck next time? hehe.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
![]() Quote:
If so, it's a good effort - in particular I liked your use of recursion! Last edited by ephemera; 1st April 2009 at 06:10 AM. |
|
|||
![]()
I followed some tips from Wikipedia (e.g., use recursion instead of iteration, ?: instead of if-else, etc.), but I wrote the program and converted to obfuscated code myself.
__________________
And the WORD was made flesh, and dwelt among us. (John 1:14) |
|
||||
![]()
Cool.
Somehow obfuscation never caught my fancy. Anyway, any code of some size and complexity without good comments is obfuscated enough for me. ![]() You might have probably seen this one, its cool: http://www.cs.uleth.ca/~holzmann/C/C/cselfprint.html Last edited by ephemera; 2nd April 2009 at 02:46 PM. |
|
||||
![]()
if you want to use the ?: trinary/ternary operator to obfuscate things, be sure to nest them in strange and deranged ways, and slip in comma's and garbage values anywhere you can.
In my personal opinion, good code should be fairly obvious even without comments, and the comments should be free to provide 'commentary' and annotations instead of explaining away physical laziness. e.g. Code:
/* push element onto int stack */ istk_t istkp(iskt_t *s, iskt_t *e); vs istack_t istack_push( istack_t *stk, istack_t *elem); Those bastardo 2000+ line procedures some people write on the other hand, just need to be drawn and quartered ;-)
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
|
||||
![]()
I used to be an APL programmer, back in the late '70s. And through until around 1981, or so, when I moved to systems programming (today, that would be systems administration, but back then, we modified our OSes to meet requirements).
APL had some interesting capabilities, helpful for financial analysis applications (I was working for a commodities trading firm). Special keyboards and terminals were needed, however. I did end up learning how to pronounce and spell most of the Greek alphabet, of course, as any APL programmer would. But along with Ro and Pho and Theta, we also used words to describe symbolic functions that were not Greek. The left and right arrows, for example, were called the "guzinta" and "guzouta". One could write a line of code that would perform an operation on a large vector of numbers, that might contain, for example, twenty thousand integers, all at once. But, if the programmer misplaced a comma, rather than making a single arithmetic operation on twenty thousand numbers at once, one would instead execute twenty thousand individual operations. You'd get the same results, but thousands of times more slowly. Just from putting the comma in the wrong place. I moved from APL to S/370 Assembler. The latter was so much clearer and easier to understand. ![]() |
|
||||
![]()
The number of people who have received :wq! and kkkkk messages from me, are living prove that I could never program in APL or any language needing a special keyboard, even if I think leaving near-ASCII behind is a Good Thing.
__________________
My Journal Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''. |
![]() |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Programming QL-500 (ASCII Code) | PetitConcept | FreeBSD General | 1 | 29th June 2009 10:08 PM |
Comparison of Code Quality | JMJ_coder | Other BSD and UNIX/UNIX-like | 13 | 11th April 2009 03:40 AM |
Source code for ed? | matt | FreeBSD Ports and Packages | 1 | 21st October 2008 08:18 PM |
Compiling OpenBSD code | WeakSauceIII | OpenBSD General | 4 | 19th May 2008 12:59 AM |