• Facepunch Obfuscation Challenge
    109 replies, posted
Don't waste too much time trying to obfuscate the code itself. Any code formatter will fix it in the deobfuscation process. Concentrate on the algorithm.
[QUOTE=Dienes;44814347]Any code formatter will fix it in the deobfuscation process.[/QUOTE] like this [code]#include <stdio.h> int main() { int BF = BUFSIZ; char buf[BF]; char ns[BF]; int p = 0; fgets(buf, sizeof buf, stdin); for (int i = 00; i < BF; i++) { if (buf[i] > '0' - 1 && buf[i] <= 0 + '9') { ns[p] = buf[i]; p++; } } int num = 0; char *np = "not "; for (int c = 00; ns[c] > '\0'; c++) num = num * 10 + ns[c] - '0'; if (num > 2 && num % 2 > 0) { for (int i = 2; i * i <= num; i++) { if (1 && num % i + 0 == 0) { printf(np); break; } } } else { printf(np); } printf("prime\n"); return 0; } [/code]
[QUOTE=Mega1mpact;44814330]an attempt was made [code]#include <stdio.h> int/**/main( ){int/**/BF=BUFSIZ ;char /**/buf [BF]; ;;char ns/* */[BF] ;int p = 0; /* */ fgets( buf, /* */ sizeof buf, stdin );for (int i =00; i<BF;i ++){if(buf[i]>'0'-1&&buf[i]<=0 +'9'){ns[p]=buf[i];p++;}}int/* */num=0;char*np ="not "; for(int c=00; ns[c] >'\0'; c++ )num= num *10+ns [c]- '0';if(num>2&&num %2>0){for( int/**/ i=2;i* i<=num ;i ++ ){ if (1 && num%i+ 0==0){ printf( np ); break ;; }; ;; }; ;; ;} else{printf(np);}printf("prime\n");return 0;}[/code][/QUOTE] Fancy, but you're supposed to PM it to me :v:
[QUOTE=supersnail11;44817882]Fancy, but you're supposed to PM it to me :v:[/QUOTE] I'll make something better tomorrow.
Submitted mine. Looking forward to seeing everyone elses :v:
I've finally entered my first ever programming competition. Now we wait for the analysis round...my favorite!
How did youse learn to make obfuscated and weird code, I am very curious on doing this, it's like an art. I will definitely be checking out everyone's code at the end of this too see what you guys did.
[I]You will be provided a random large integer, via stdin.[/I] How large is large? How many digits?
[QUOTE=AnonTakesOver;44823216]How did youse learn to make obfuscated and weird code, I am very curious on doing this, it's like an art.[/QUOTE] I guess its mostly observation and general creativity, when you see something in a language and go "oh thats really strange why would anyone do it that way" (You say this a lot if you inherit a codebase from someone at work) and this is one of those few places where you can use that knowledge you learned. Thats at least my strategy. Others are proabbly just going to claim they are a natural obfuscation champion because they write it all day :v:
[QUOTE=ollie;44823850][I]You will be provided a random large integer, via stdin.[/I] How large is large? How many digits?[/QUOTE] Probably should've mentioned that. 32-bit.
Alrighty, submitted my entry.
Me too.
The people I've gotten entries from so far: [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] Jookia [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] jamie1130 [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] Blasphemy [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] benjojo [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] thrawn2787 [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] CarLuver69 [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] Simspelaaja [IMG]http://i.imgur.com/1yYlmXB.png[/IMG] ollie If you've submitted one but you're not on this list, you should tell me!
[QUOTE=supersnail11;44825246]Probably should've mentioned that. 32-bit.[/QUOTE] You might have to compile my program with optimizations otherwise the probability of segmentation faults on a number goes up, so you might have to run it multiple times.
Yeah uh I completely fucked up and mine doesn't take input from stdin and actually uses an argument :c sorry!
Is it valid to rely on compiler bugs?
[QUOTE=Tobba;44831235]Is it valid to rely on compiler bugs?[/QUOTE] I think the code should be valid according to the programming language's standard.
What about proprietary stuff? Matlab for example?
[QUOTE=ollie;44831249]I think the code should be valid according to the programming language's standard.[/QUOTE] Its technically undefined behavior and the compiler decides to act in a fuck-all manner on it
@supersnail11 Did you receive my entry?
[QUOTE=jamie1130;44830797]Yeah uh I completely fucked up and mine doesn't take input from stdin and actually uses an argument :c sorry![/QUOTE] You can just resubmit it with your fixes. [QUOTE=Killuah;44831350]What about proprietary stuff? Matlab for example?[/QUOTE] Since I have to check if it works, it should be something I can compile myself. [QUOTE=cartman300;44831512]@supersnail11 Did you receive my entry?[/QUOTE] Yep.
[QUOTE=supersnail11;44835290]Since I have to check if it works, it should be something I can compile myself.[/QUOTE] you should limit it to entries that work with freely available compilers
[QUOTE=sambooo;44836557]you should limit it to entries that work with freely available compilers[/QUOTE] [quote=Rules]• You must use an actual programming language. That means: [img]http://i.imgur.com/LGxkqEY.png[/img]• It must have real, public documentation [img]http://i.imgur.com/LGxkqEY.png[/img]• It must be publicly available for download. [img]http://i.imgur.com/LGxkqEY.png[/img]• It must be used for things other than joke projects (no, sorry, no brainfuck, malbolge, or piet).[/quote]
[QUOTE=supersnail11;44835290]You can just resubmit it with your fixes.[/QUOTE] Fixed it thanks :)
I'm confused now. Isn't it acceptable for our entries to work like this? [code]c:\ > prime 11 prime c:\ > prime 122 not prime[/code] If that's not the case, I'll have to resubmit mine...
[QUOTE=CarLuver69;44837647]I'm confused now. Isn't it acceptable for our entries to work like this? [code]c:\ > prime 11 prime c:\ > prime 122 not prime[/code] If that's not the case, I'll have to resubmit mine...[/QUOTE] That's what the rules said, but if everyone wrote theirs that way anyways I guess I could make an exception.
[QUOTE=supersnail11;44837768]That's what the rules said, but if everyone wrote theirs that way anyways I guess I could make an exception.[/QUOTE] I wrote mine that way because of the example in the OP.
[QUOTE=CarLuver69;44837791]I wrote mine that way because of the example in the OP.[/QUOTE] [code]$ echo 11 | prime prime $ echo 122 | prime not prime[/code] That's not the same as what you posted.
[QUOTE=supersnail11;44837821][code]$ echo 11 | prime prime $ echo 122 | prime not prime[/code] That's not the same as what you posted.[/QUOTE] Well this is embarrassing... :v:
[QUOTE=supersnail11;44837821][code]$ echo 11 | prime prime $ echo 122 | prime not prime[/code] That's not the same as what you posted.[/QUOTE] I submitted a code entry to you, but facepunch is being buggy as fuck. Can you let me know if it got through?
Sorry, you need to Log In to post a reply to this thread.