141
\$\begingroup\$

Note: This challenge is now closed to new cop submissions. This is to ensure that no one can post submissions that only remain uncracked because there aren't enough robbers interested in the challenge anymore.

In this game of cops-and-robbers, each cop will write a simple program to give a single output. They will then make public four things about their program:

  1. The language
  2. The program length
  3. The desired output
  4. A scrambled-up version of the source code

Then, the robbers must unscramble the source code so that their program functions like the original.


Cop Rules

You are to write a simple program, which the robbers will try to recreate.

Your original program must have a simple functionality: upon execution, it outputs a single string/number and halts. It should give the same output regardless of when/where it is run, and should not depend on extra libraries or the internet.

Your program and output must use printable ASCII (newlines and spaces allowed). The output should be no more than 100 characters long, and the program should take less than about 5 seconds to run on a reasonable machine. You are also not allowed to use hashing (or other cryptographic functions) in your program

Then, you provide a scrambled-up version of the source code and the required output. You can scramble up your source code however you may like, as long as characters are conserved.

Your score is the shortest program you have submitted which hasn't been cracked. After a period of one week, an uncracked submission will become immune. In order to claim this immunity, you should edit your answer to show the correct answer. (Clarification: Until you reveal the answer, you are not immune and can still be cracked.) The lowest score wins.

Simple Example Cop Answers

Perl, 20

ellir"lnto Wo d";prH

Hello World

Or...

Perl, 15

*3i)xp3rn3*x3t(

272727

Robber Rules

Robbers will post their cracking attempts as answers in a separate thread, located here.

You have one attempt at cracking each submission. Your cracking attempt will be an unscrambled version of the source code. If your guess matches the description (same characters, output, and of course language), and you are the first correct guess, then you win a point. It is important to note that your program does not have to exactly match the original, simply use the same characters and have the same functionality. This means there could be more than one correct answer.

The robber with the most points (successful cracks) wins.

Simple Example Robber Answers

Your program was print "Hello World";. (Although print"Hello World" ; could have also worked.)

Your program was print(3**3x3)x3

Safe Submissions

  1. ASP/ASP.Net, 14 (Jamie Barker)
  2. Befunge-98, 15 (FireFly)
  3. GolfScript, 16 (Peter Taylor)
  4. CJam, 19 (DLosc)
  5. GolfScript, 20 (user23013)
  6. Perl, 21 (primo)
  7. Python, 23 (mbomb007)
  8. Ruby, 27 (histocrat)
  9. SAS, 28 (ConMan)
  10. Ruby, 29 (histocrat)
  11. Python, 30 (mbomb007)
  12. JavaScript, 31 (hsl)
  13. Ruby, 33 (histocrat)
  14. Marbelous, 37 (es1024)
  15. Ruby, 43 (histocrat)
  16. PHP, 44 (kenorb)
  17. Ruby, 45 (histocrat)
  18. Marbelous, 45 (es1024)
  19. Python 2, 45 (Emil)
  20. PHP, 46 (Ismael Miguel)
  21. Haskell, 48 (nooodl)
  22. Python, 51 (DLosc)
  23. Python, 60 (Sp3000)
  24. Python 2, 62 (muddyfish)
  25. JavaScript, 68 (Jamie Barker)
  26. Mathematica, 73 (Arcinde)
  27. Haskell, 77 (proudhaskeller)
  28. Python, 90 (DLosc)
  29. C++, 104 (user23013)
  30. ECMAScript 6, 116 (Mateon1)
  31. C++11, 121 (es1024)
  32. Grass, 134 (user23013)
  33. PowerShell, 182 (christopherw)

Unsolved Submissions

In order of time of posting. This list courtesy of many users.

A small tool to verify solutions, courtesy of n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

$(function(){function e(){var e=$("#ignore-space").is(":checked");var t=$("#source").val().split("").sort();var n=$("#editor").val().split("").sort();var r,i=0;for(r=0;r<t.length;){if(t[r]==n[i]){t.splice(r,1);n.splice(i,1)}else if(t[r]>n[i]){i++}else{r++}}$("#display").val(t.join(""));n=n.join("");if(e){n=n.replace(/[\r\n\t ]/g,"")}if(n.length!=0){$("#status").addClass("bad").removeClass("good").text("Exceeded quota: "+n)}else{$("#status").addClass("good").removeClass("bad").text("OK")}}$("#source, #editor").on("keyup",function(){e()});$("#ignore-space").on("click",function(){e()});e()})
textarea{width:100%;border:thin solid emboss}#status{width:auto;border:thin solid;padding:.5em;margin:.5em 0}.bad{background-color:#FFF0F0;color:#E00}.good{background-color:#F0FFF0;color:#2C2}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<h3>Scrambled Source</h3>
<textarea id="source" class="content" rows="10"></textarea>
<h3>Unused Characters</h3>
<textarea id="display" class="content" rows="10" readonly></textarea>
<h3>Your Solution</h3>
<input type="checkbox" id="ignore-space" name="ignore-space"/>
<label for="ignore-space">Ignore space characters</label>
<div id="status" class="good">OK</div>
<textarea id="editor" class="content" rows="10"></textarea>

\$\endgroup\$
  • 4
    \$\begingroup\$ @xnor Yes, that's what it means. \$\endgroup\$ – PhiNotPi Nov 4 '14 at 20:00
  • 3
    \$\begingroup\$ You might want to forbid hashing... codegolf.stackexchange.com/questions/40304/… \$\endgroup\$ – NinjaBearMonkey Nov 4 '14 at 20:00
  • 7
    \$\begingroup\$ You should probably specify that the winner must post the original source code after one week. What prevents me from posting gibberish and claiming that none of the robbers got the right answer? \$\endgroup\$ – user2023861 Nov 4 '14 at 21:54
  • 60
    \$\begingroup\$ I thought "Oh, il just write a malbolge program, scramble it, and win this thing!". But then, i tried to write a malbolge program. \$\endgroup\$ – rodolphito Nov 5 '14 at 4:56
  • 8
    \$\begingroup\$ Warning: Cops, do not use Ideone to test your submissions, as it stores your programs and other people can see them. \$\endgroup\$ – rodolphito Nov 6 '14 at 4:48

240 Answers 240

0
\$\begingroup\$

BBC BASIC, 187 - Cracked

Code

$$$$$$$$$$$$$$$$$$$$$((((((((((((((((((((()))))))))))))))))))))00000000111111111111111111111111122223333447778889999999CCCCCCCCCCCCCCCCCCCCCHHHHHHHHHHHHHHHHHHHHHINPRRRRRRRRRRRRRRRRRRRRRRT

Output

you'll never crack me
\$\endgroup\$
0
\$\begingroup\$

PHP, 54, Cracked

Code

$$$$$$$$$$&(())11122;;;;<<====^^aaaabbbbbbceehhilow{}

Output

42

Original

$a=21;$b=21;while($b){$a^=$b;$b=($b&$a^$b)<<1;}echo$a;

Original idea

\$\endgroup\$
0
\$\begingroup\$

Python 2 - 57 Cracked

Code

''((()))+++++++,,,,.000000001111113444589abchiijmnnopprrt

Output

blue

Blue is the best colour ;)

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – Sp3000 Nov 5 '14 at 21:04
0
\$\begingroup\$

PHP, 22 - Cracked by Martin Büttner

Code:

((()))*+..0117;cehinot

Output:

7

Original

echo(int)((.1+.7)*10);

\$\endgroup\$
0
\$\begingroup\$

PHP, 27 (Cracked by bwoebi)

Code:

$$((()))02679;;=__bdeehiinx

Output (default on PHP 5.4.x):

3.1415926535898

Output (default on PHP 5.5.x):

3.14159265359

Hint: It depends on your php.ini precision, so hopefully it's acceptable.


Original:

$_=hex2bin(7069);die($_());

\$\endgroup\$
  • 1
    \$\begingroup\$ Cracked ... hey, please make the next one a challenge, not cracked in 5 minutes; please :-) \$\endgroup\$ – bwoebi Nov 6 '14 at 1:10
0
\$\begingroup\$

Java, size 108

Code

forprintmymostfaultSent66{{{}}}.......;""(((())))%,*++//\\--''''''''''''main static class void public String

Output

3.141593
\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 8 '14 at 19:05
0
\$\begingroup\$

C, 28 (cracked by feersum)

0124689aimnpsssstu=;;&{}(())

Prints Hi!

\$\endgroup\$
  • 3
    \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 6 '14 at 16:08
  • \$\begingroup\$ Drat, you beat me to it \$\endgroup\$ – squeamish ossifrage Nov 6 '14 at 16:09
  • \$\begingroup\$ Oh come on ! 7 minutes ? You are awesomes guys. \$\endgroup\$ – Michael M. Nov 6 '14 at 16:11
0
\$\begingroup\$

Bash shell script, 33 characters

Code

{int wk1}'caller$' hop|hop sewer

Output

shellpower
\$\endgroup\$
0
\$\begingroup\$

Python 3, 46

Program

""''''((()))*01==bbffiiillnnnooooppprrrrrttt

Plus two newlines.

Output

'(otlotb)'
\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 7 '14 at 1:53
  • \$\begingroup\$ @feersum: invalid link. Updated. \$\endgroup\$ – imallett Nov 7 '14 at 8:10
0
\$\begingroup\$

Java 6+ / Oracle implementation (Cracked by feersum)

Code (226 bytes)

There are 5 new line characters and 2 spaces. No other invisible/non-printable character presents.

"""  ((((((()))))))++,........
00000000000001122225677788
;;;DEIPPSSS[\\\\\\\]aaaaaaaaaaaabccccccccddeeeeeeeeeeeef
gggghiiiiiiiiiiiijllllmmmmnnnnnnnnnoooooopppppprrrrrrrr
sssssstttttttttttttttttttuuuuuuuuuuuuuvvxxyyyz
{{{{}}}}

Output

91 Unmatched closing ')'

The program has been tested to compile and run successfully on ideone, so please submit an answer with runnable demo there.


feersum's solution is far from my intended solution, so I will not reveal my intended solution since I'm going to modify it for a new challenge.

\$\endgroup\$
  • \$\begingroup\$ Is there anything wrong with this submission? By the way, Oracle's implementation should be the most common one around. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 5 '14 at 16:19
  • 1
    \$\begingroup\$ By "run successfully" does that mean it doesn't throw an error? (So you actually System.out.println("91 Unmatched closing ')')" or something along those lines)? Or is the output just output from println, errors, etc. combined? \$\endgroup\$ – soktinpk Nov 5 '14 at 21:33
  • \$\begingroup\$ @soktinpk: Output is to stdout. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 6 '14 at 2:15
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 7 '14 at 8:42
0
\$\begingroup\$

JavaScript, 285

Code

\n\n\n\n\n\n      """"""(((((((()))))))),,,,.........///////0001111222222333334566666777777889999:========ACCEGHJLLLMNORSTTX[]_aaaaaaaaaaaaaaaaaabbbccddddeeeeeeeeeeeeeeeeeefffffgghhhhhiiiiiiiiijlmmmmmnnnnnnnnnoooooooooooooooopppppqrrrrrrrrrrrrrrrrrrssssssssssssssstttttttttttttttuuuvvvwwwwxz

Note: The \ns are one character.

Output

AZ
\$\endgroup\$
0
\$\begingroup\$

Python, 41 bytes

Code:

_dtrupar_p)o_(prm(txnrr_e)i)(mei er,(.)ps

Output:

6314
\$\endgroup\$
  • 1
    \$\begingroup\$ Cracked... and -1 for being implementation-dependent :P \$\endgroup\$ – feersum Nov 7 '14 at 21:38
0
\$\begingroup\$

Arithmetic (ECMAScript, Java, C, C++, BASIC, Perl, Python, Ruby), 31

Code

((((((()))))))****++++111122222

Output

77

\$\endgroup\$
  • \$\begingroup\$ Cracked. \$\endgroup\$ – NinjaBearMonkey Nov 8 '14 at 1:47
  • \$\begingroup\$ Nice work both of you! \$\endgroup\$ – Cris Nov 8 '14 at 14:49
0
\$\begingroup\$

Bash

23 characters long.

Cracked by user23013 [link].

BASH_VERSION is "3.2.53(1)-release"

Source (original)

_(){ q=echo;$q "$q";};_

Source (scrambled)

;{e) $ qq"}";oh_$_=q(;c

Output

echo
\$\endgroup\$
  • \$\begingroup\$ I believe there should be one more space character. \$\endgroup\$ – jimmy23013 Nov 7 '14 at 10:11
  • \$\begingroup\$ But it is still possible without that. Cracked. \$\endgroup\$ – jimmy23013 Nov 7 '14 at 10:20
0
\$\begingroup\$

C (gcc) - 43 - Cracked

Code

""%%&(()),7;[]aabdeeefiiiimnnnnpprrsstuux{}

Output

se7en

Trust me, you don't want to open this box...

(My unscrambled code will only work in non-strict C. For example, here)


Original

main(superbia){printf(&unix["%se%den"],7);}

\$\endgroup\$
  • \$\begingroup\$ Is it permitted to output a newline after se7en? \$\endgroup\$ – feersum Nov 7 '14 at 21:58
  • \$\begingroup\$ Cracked. \$\endgroup\$ – nneonneo Nov 7 '14 at 22:03
  • \$\begingroup\$ unix is an undeclared identifier for me. \$\endgroup\$ – feersum Nov 8 '14 at 12:30
  • \$\begingroup\$ @feersum Yeah, I don't think this would've counted then, even if nneonneo hadn't cracked it. I thought that unix was still defined if your OS was unix based, but I guess I was wrong ;_; \$\endgroup\$ – FryAmTheEggman Nov 8 '14 at 15:06
  • \$\begingroup\$ And if your OS isn't unix-based? \$\endgroup\$ – feersum Nov 8 '14 at 15:07
0
\$\begingroup\$

Javascript (41 bytes) - Cracked

It should be a piece of cake to crack.

Here is the code:

'cccefhiinnnnooorrrrsstttttuuu)))} {(((.'

This is supposed to give the window object.

Probably will work on node.js

Have fun!

P.S.: Please don't crack it!!!

\$\endgroup\$
0
\$\begingroup\$

Python 2, 37

Code

print(len(ord(Emvies.priwilimmstys)))

Output:

1

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – Sp3000 Nov 8 '14 at 16:39
0
\$\begingroup\$

Javascript (82 bytes) - Cracked

Since my first Javascript attempt was cracked in 6 hours, I decided to make another one!

Here it is:

eval('zov=~-1+(ii=1<2);if(0^1<2 in[3]<=+[])ii+[zov]+[]<<ii;//cog=lovr;s.n,r,o.j');

As the PHP answer, you can run it and it will return 0.

The unscrambled version outputs this:

131713115131713131131713115131713163131713115131713131131713115131713112713171311513171313113171386

I hope that this one survives a day.

Have fun and don't crack it!!!

\$\endgroup\$
0
\$\begingroup\$

C, 63 (Cracked)

Code

int main(_){_;_<_<_;_=_;_______;printf("%d",_<=_<<_||_<<_<=_);}

Output

131088

Original Solution

__;int main(_){__=_<<_<<_;__=_<<__;_<<=__|_;printf("%d",_|__);}

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – feersum Nov 8 '14 at 12:28
0
\$\begingroup\$

PHP (80 bytes) - Cracked

Yes, this is one more answer from me!

Here is a new one, fresh for you all:

$$__=aAaAaa;$$___=(b^C^Fff^IIi);$$____=j^k^N^Oo^PPp;$$_____=Qrr+tTT.(UWW<XXyZ);;

As always: You can run it and it will print absolutely nothing. (same as the numeric value 0 converted to string)

The output:

:

That's right, 1 byte of output!

Go ahead and have fun with this one!

\$\endgroup\$
0
\$\begingroup\$

PHP (33 bytes) - Cracked:

This one is pretty easy to crack.

It only works on linux.

Scrambled code:

X1dFu7Te48oklB ^ HDecnX0iTch0T6g;

Output (if everything goes right):

1

PHP (24 bytes): (I won't count this one, untested)

This is the windows-only variation of the SAME code.

The difference is the size and that I needed to add quotes.

Scrambled:

'dc6iunXB7 ^ heoedcX4l';

Output:

1

Both scrambled codes can be run.

Have fun!!!

\$\endgroup\$
0
\$\begingroup\$

PHP (46 bytes) - Cracked:

Yet another one from me.

This one is kinda easy.

I did my best to have 1 and only 1 solution.

Here it is:

echo$o=rand(m^z&E+$i,$i=(H<Y)or$Y[$i+f<<z]);;;

And outputs:

band

As with some of my previous answers:

You can run the scrambled code.
Depending on it's mood, outputs either 0 or 1.

Have fun!

\$\endgroup\$
  • \$\begingroup\$ Cracked. \$\endgroup\$ – es1024 Nov 10 '14 at 11:37
0
\$\begingroup\$

Bash 4.2.47(1) on Linux, 47 characters

${porcel-=str('pix fep\n     pp/pp/'); fec1/; }

Output, without newline:

pp

Finding some solution is easy:

printf pp;o='${cel-sr(xe\     pp/pp/) fec1/; }'

Try to find the original code, without comment-like things like thow-away assignments or "hungry" identifier names.

\$\endgroup\$
  • 3
    \$\begingroup\$ That's not how this challenge works though. ;) if you want people to find your original code, it's your job as a cop to make sure no other solution exists. \$\endgroup\$ – Martin Ender Nov 11 '14 at 7:32
  • \$\begingroup\$ Cracked...it was very kind of you to post the solution! \$\endgroup\$ – feersum Nov 11 '14 at 23:47
0
\$\begingroup\$

Python, size 37

Scrambled:

"    "*+++.123334:=
=deefiinnoprrstuu

Output:

12369.0
\$\endgroup\$
0
\$\begingroup\$

PHP, 62 chars

"fine".Music <= radio?'==;;'(.')()+')+$yeTi:2('3(;)1$$$hoo.'.

Output:

1. Monday 2. Tuesday 
\$\endgroup\$
0
\$\begingroup\$

Perl, 53 bytes

Code:

$thriller='24'&&$prng=4;tar xvw'~'.$e/=3332+42*$i/~$r

Output:

3155242264414961265415109674813320

No trailing newline this time. Tested in Perl 5.18.2, but should work fine on other versions.

\$\endgroup\$
0
\$\begingroup\$

Marbelous, 48 (Cracked)

Code

_______&&--...../000000000011111111:<<=@@@@\{}}}

_ represents a newline.

Output

"

(Yes, just one double quote.)

JS Marbelous Interpreter

Unlike many of my other Marbelous cops, this one does not use cylindrical boards.

\$\endgroup\$
0
\$\begingroup\$

J 25

+3oh.5- #+-ii#3c!//4e.2%/

output

3
\$\endgroup\$
0
\$\begingroup\$

Marbelous, 144

Code

______________________________!!!&&+++++----..........////////0000000000000000000000111111227888::::::<<<<<<<<<=>>>>>>>>>@@@@@@AAOO\\\\^^^{}}}}}

_ represents a newline.

Output

31 2F 2E 2C 2B 29 28 26 25 23 22 20 1F 1D 1C 1A 19 17 16 14 13 11 10 0E 0D 0B 0A 08 07 05 04 02 01 

There is a space+newline at the end.

JS Marbelous Interpreter

Cylindrical boards required.

Hints:

A001651 in hexadecimal, backwards

(a >> 4) and (a << 4) >> 4

\$\endgroup\$
0
\$\begingroup\$

Python, 90 bytes (SAFE)

Kinda long, but I enjoyed putting this together.

Code:

??(((())))+++++++,1111111111111111111111:;;<<<<======>>>>>[[]]ehiilnnnnnnnnnnpppprrrsstttw

The ?s represent two newlines.

Output:

6167185029251277541387741632208161040852042602130139041952976

Output is followed by a newline. Works in Python 2 or 3.

Solution:

n=11111+1111+111+1;p=str() while n>1111:n=[(n<<1)+n+1,n>>1][n>>1<<1==n];p+=str(n) print(p)

Calculates several iterations of the 3n+1 function starting at 12334 and continuing until the value dips below 1111, concatenating the results together. For obfuscation, uses only 1's and bitwise operators to calculate the function (which would more straightforwardly be n/2 if n%2==0 else 3*n+1).

\$\endgroup\$

protected by squeamish ossifrage Jan 10 '15 at 19:15

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.