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


Perl, 15



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>

  • 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
  • 62
    \$\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

241 Answers 241


Python, 90 bytes (SAFE)

Kinda long, but I enjoyed putting this together.



The ?s represent two newlines.



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


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).


C - size 19


int main(){return;}

There is 1 space.


Segmentation fault

or similar.

Compiled in http://codepad.org/

  • 1
    \$\begingroup\$ OS? Compiler? Segmentation fault usually is the by product of undefined behavior, and it varies between systems. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 19 '14 at 5:14
  • \$\begingroup\$ @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ edited \$\endgroup\$ – Olavi Mustanoja Nov 19 '14 at 15:05
  • \$\begingroup\$ Cracked. \$\endgroup\$ – jimmy23013 Nov 20 '14 at 2:22

Python [any] shell size 44 (Cracked)

4no_,2_[a(m] g]]fn_mie___e[nenr aa )1__[r3 _



Haskell, size 34 (Cracked)




  • \$\begingroup\$ I'm tempted to claim that this violates the "you may not use cryptographic functions" rule, except that any self-respecting cryptographic function would use a big prime instead of 2^64 for its modulus... Perhaps if I knew a bit more I would know how to exploit this choice. Very clever choice of problem. \$\endgroup\$ – Daniel Wagner Nov 7 '14 at 8:05
  • 2
    \$\begingroup\$ cracked \$\endgroup\$ – Daniel Wagner Nov 7 '14 at 9:06
  • \$\begingroup\$ @DanielWagner Good job. I'd say that exponentiation isn't a cryptographic function, even with the 2^32 modulus. Perhaps I should have used ** instead of ^ to make the guess slightly harder. \$\endgroup\$ – Petr Pudlák Nov 7 '14 at 11:01
  • \$\begingroup\$ Number Theory != Cryptography \$\endgroup\$ – recursion.ninja Nov 8 '14 at 16:53

ECMAScript, 25 (Cracked)

Executed on window object




function alert() { [native code] }

  • 3
    \$\begingroup\$ Just double checking, are you sure, you're not missing a comma? (Alternatively, does it produce errors as a side effect?) \$\endgroup\$ – Martin Ender Nov 5 '14 at 23:16
  • 2
    \$\begingroup\$ The built-in function alert isn't mentioned in the ECMAScript spec, so I think you need to be more specific about the execution environment in which this output is produced. \$\endgroup\$ – Peter Taylor Nov 5 '14 at 23:55
  • 2
    \$\begingroup\$ There are 24 characters given in your answer \$\endgroup\$ – es1024 Nov 6 '14 at 3:10
  • \$\begingroup\$ @MartinBüttner correct. Thank you for that. Adding comma. \$\endgroup\$ – Cris Nov 6 '14 at 12:48
  • 1
    \$\begingroup\$ Cracked. \$\endgroup\$ – Martin Ender Nov 6 '14 at 12:54

C++, 244 bytes (one linebreak, 19 spaces) (Cracked)




hello world!

A couple hints

  • Output is achieved using a really unorthodox process.
  • The source code isn't 'scrambled', per se. (Just alphabetized.)
  • \$\begingroup\$ How many spaces? I counted only 224 non-whitespace characters. With the initial space and new line, that makes 226 bytes, not 244. \$\endgroup\$ – squeamish ossifrage Nov 19 '14 at 23:01
  • \$\begingroup\$ Cracked, I think \$\endgroup\$ – squeamish ossifrage Nov 19 '14 at 23:27
  • \$\begingroup\$ I had a method in my scrambler that counted the number of bytes that were in the file it loaded into memory. It said '244 bites', so I went with that. (Edit: verified character count with an ascii counter online. 244 is accurate.) Also, @squeamishossifrage, It does the same thing, but the extra characters ARE used, not just tossed into the end. =P \$\endgroup\$ – Gabe Evans Nov 20 '14 at 0:16
  • \$\begingroup\$ I just realized most of those characters are used in variable names. Didn't realize smallest score won. >_< \$\endgroup\$ – Gabe Evans Nov 20 '14 at 0:31

Haskell, 77

this poorly mixed code:

{tt))=Maprte((e)=))+-1%%&&tt} %%:i=ddeno:p:)illme((m;;;<=;()&&()):a6::1=(((no

output Should be

Code.exe: <<loop>>

To clarify: the code should be saved in a file named Code.exe. otherwise the output would have the actual file name instead of Code.exe.

more than a week has passed since this was published.

original version:

main=mapM print(&);(&)=1:(&)%(&);(16:(:){})%t=t;(e:d)%(l:o)=(e+l):d%o;e<t=e-t

this uses a few tricks:
a variable named (&) that isn't a function

a record pattern not on a record (:){}

a useless definition of < to get people confused what to do with the extra = sign

the runtime prints <<loop>> because we entered into a trackable infinite loop (at the fifth element and on of (&)).

  • \$\begingroup\$ Regarding the last line, is it actually written to stdout? \$\endgroup\$ – FireFly Nov 8 '14 at 3:59
  • \$\begingroup\$ @FireFly as an uncatched exception it is written to stdout and then the program terminates \$\endgroup\$ – proud haskeller Nov 8 '14 at 6:34
  • \$\begingroup\$ When I checked locally, exceptions were printed to stderr for me (on linux), and not stdout. I suppose it might print to stdout on windows, though? Still seems a bit odd. \$\endgroup\$ – FireFly Nov 16 '14 at 0:27
  • \$\begingroup\$ And you get a completely different message with jhc. \$\endgroup\$ – John Meacham Nov 20 '14 at 14:49

C - size 62 (Cracked)


)#<("pitiful tit,handfin descended in +18_minor.")>#(%{;__*}

There are 4 spaces and 2 newlines \n in the source (not in output).



Possible error thrown not taken into account.

  • \$\begingroup\$ Would you please confirm the cracking attempt by user23013? The cracking attempt seems to have too many spaces. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 20 '14 at 10:13
  • \$\begingroup\$ @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ wasn't gonna until I got home, but looking at it quickly I'd say there's 5 spaces in his attempt. Only 4 spaces in the actual code, though, so doesn't pass. \$\endgroup\$ – Olavi Mustanoja Nov 20 '14 at 10:35
  • \$\begingroup\$ @user23013 Sorry but 1 space too much \$\endgroup\$ – Olavi Mustanoja Nov 20 '14 at 10:35
  • \$\begingroup\$ Cracked. \$\endgroup\$ – es1024 Nov 22 '14 at 9:38

C - size 33 (Cracked)


#() {} * +257;

So 3 spaces and 1 newline


Exits with return code 173


Javascript, 35

Scrambled: a)o29t;((1lae1.2(ll=h3t(;rM)4)g)lll7

Output: 0.674284933420515


Python 2, 45 [safe]



(Contains one newline and no further whitespace.)



Hint (though I'm not sure it helps):

If you replace the 3 by a 4 the output grows to 993 digits. For 5 it's even 91585 digits.


u=3 print`reduce(pow,(u*u-(oct>id),)*u)`[::u]


Okay, maybe this was overdone. :-) The (oct>id) was a red herring and is just a fancy way of spelling 1 because in Python functions are ordered alphabetically by name. Using tuple multiplication, the argument of the reduce function then boils to reduce(pow,(8,8,8)) which is ((8)**8)**8 or6277101735386680763835789423207666416102355444464034512896. Because this would be an easily recognizable number, it's then converted to a string and only every third digit is printed.


Python 2, 80

Source (original)

"no %, *, any for loops, nor pow()"
print int(str((61**38)/(702+4)+5)[9:])

Source (scrambled)

"         "%



This one demonstrates something pretty neat (and surprisingly poorly known):

Python, 16



Output (from interpreter)


I can't say much without giving a big hint, but this depends on an interpretation of the rules that I think is fair, reasonable, and expected.

I didn't make a separate answer for this next one since it bends the rules a little. It's technically still fully compliant, but it's a little outside their spirit. It's also really mean. I'm sorry.

Python, 61 [SAFE-ish]

Code (plus two newlines)

#  ((()))*****----012345:aabbbcccdeeeggggginnoorsttuvvvyzzz

Output (from file)


Update: explanation:

As guessed in the comments, this is indeed rot13 encoded. The rules state "You are also not allowed to use hashing (or other cryptographic functions) in your program", but the character encoding defines how the editor interprets the bits that comprise the program, not the program itself. Clearly, this violates the spirit of the rule. Original source:
sebz zngu vzcbeg*

  • \$\begingroup\$ Is the second one using ROT13 encoding? Because, if so, yes that is pretty mean. :P \$\endgroup\$ – Sp3000 Nov 7 '14 at 8:21
  • \$\begingroup\$ (Also if so you might want to specify that it's Python 2, not 3. Ignore me if I'm wrong though.) \$\endgroup\$ – Sp3000 Nov 7 '14 at 8:34
  • 1
    \$\begingroup\$ The question forbids "cryptographic functions". ROT-13 is technically a cryptographic function, so it would be forbidden. \$\endgroup\$ – feersum Nov 7 '14 at 8:44
  • 1
    \$\begingroup\$ I've cracked the first one, assuming Python 2 is acceptable. \$\endgroup\$ – squeamish ossifrage Nov 7 '14 at 8:52
  • 1
    \$\begingroup\$ @imallett The question asks for a program. It's standard rules for the site that a program means a program, and not some code fragment which could be evaluated. And a cryptographic function is a cryptographic function regardless of how it is invoked. \$\endgroup\$ – feersum Nov 7 '14 at 21:08

JavaScript, 24 characters


('oogles').oil + 'chn';



(with newline)

Works on pretty much any browser, or Node.js (but not Rhino).

Should be very easy to crack.

  • \$\begingroup\$ Cracked. \$\endgroup\$ – Martin Ender Jan 2 '15 at 18:10
  • \$\begingroup\$ Sorry, there was an extra period in the scrambled version. Your solution works, though! \$\endgroup\$ – 190n Jan 3 '15 at 0:14

JavaScript, 72 [SAFE]



Code scramble:





Python, 39 [Cracked]

Scrambled code



  • \$\begingroup\$ Cracked yesterday but forgot to post here, sorry. \$\endgroup\$ – Uri Granta Jan 6 '15 at 12:15

Processing, 77

Scrambled code -

// L0L =>
Lint( <.< ^=^ ;=; >=< ^ );
script {wh LLL >> LLL};

Prints this to the console -


It also opens a small window with a grey square in it, the same thing that shows up when you run a totally blank sketch. I don't think there's anything I can do about this in Processing.

Tested in Processing 2.2.1 but should work in pretty much any version. Thanks for playing!


PHP, 56 chars


(begins with two spaces)




I thought this one was fairly easy.


This code relies on just one math function.


Python, 13 [Cracked]





Python 2 (Cracked)

Scrambled Code:

int r*37230,
p rp tin * 73



CMD, 9 (Cracked)


No spaces in source - Just a big fan of Oaties.

Output: 1


Javascript - 15 (Cracked)

Scrambled Code








Python, size 15 (Cracked)

This one is for the gold, though I find that unlikely. Again using http://repl.it/




=> '6991'

Original Source

~4 is just a fancy way to write -3

  • \$\begingroup\$ Cracked \$\endgroup\$ – squeamish ossifrage Jan 13 '15 at 7:59
  • \$\begingroup\$ Does anyone know how I can correctly format the code in the solution? The backticks need to be escaped, but it'd be nice if the code could be formatted like code also (which normally involves surrounded with backticks, but it won't work.) Indenting with 4 spaces isn't working either. \$\endgroup\$ – mbomb007 Jan 13 '15 at 17:46
  • \$\begingroup\$ @squeamishossifrage Thanks. \$\endgroup\$ – mbomb007 Jan 13 '15 at 21:11

CMD, 21 (Cracked)

echo "/test!!">>afile

No files are produced.

Output: 0

Original program

set /a"!echo>>!tfile"

I evaluate two separate strings with ! (negation), each producing 1 - then perform a logical shift >> on the two values - which produces 0.


Javascript - 68 [SAFE]

Scrambled Code

''''((( )))++,,.00012567;==ABCCISaaadeeffffghimnnooprrrrrssssssttvxx




var s=String,sf=s.fromCharCode;sf(57)+sf('0x2B')+parseInt('0x0A',16)


Python 2, 78

int pint=2222222****************2222222****************2222222,
rp r= 61727176



UPDATE The output has a newline after it.


Python, size 30 (Cracked)

This one is just for fun, since my last one wasn't solved. :D
Again using http://repl.it/


:: rsin[~rot13('0ddf') + 69][]


=> 'rot13'

Original Source

Will be posted later, because I didn't like his workaround. Solve THIS instead. Nobody solved it! Muahahaha!

str(d for d in[])[9:6:~0]+'13'

For an explanation, go to the link above.                    ^

Just to be more clear that the '=>' isn't part of the string

  • \$\begingroup\$ Cracked \$\endgroup\$ – squeamish ossifrage Jan 13 '15 at 8:02
  • \$\begingroup\$ It appears you found a workaround. Editing it to remove the possibility of that workaround. \$\endgroup\$ – mbomb007 Jan 13 '15 at 17:37

Javascript (Node.js REPL), 11 bytes

Just for fun. Here is the verifier for the program that generates a circular list.


Expected output:

[ [Circular] ]

Spoiler (don't cheat!)

Spoiler since no cop solutions are allowed anymore (written by wizzwizz4): (x=[])[0]=x


Python 2, 89 - Cracked




No output to STDOUT ;)

  • 2
    \$\begingroup\$ Cracked. Turns out no unscrambling was necessary! \$\endgroup\$ – feersum Nov 7 '14 at 9:34
  • \$\begingroup\$ @feersum I don't know if it's allowed, but I clarified what my code should do... \$\endgroup\$ – Beta Decay Nov 7 '14 at 9:36
  • \$\begingroup\$ "Your program and output must use printable ASCII." And no fair adding new output after I already cracked it... \$\endgroup\$ – feersum Nov 7 '14 at 9:37

Java 6+ / Oracle's implementation (218 bytes)



There are 5 new lines and 1 space. No other invisible character.


723Unmatched closing ')'

With these many characters, it is probably open for many possibilities.


I don't know if there is any other solution, but it seems I have limit the solution to the following direction quite well.

main(String){try{Pattern.compile(((()))+.....000000000111222225677DI\\\\\\aaacdeeeeeffggiijnnopqqqqrstttuuuuux,);}catch(PatternSyntaxException ){System.out.print();}}}

And second hint is long-standing bug.

  • \$\begingroup\$ Hmm, seems familiar, didn't I already do that one? \$\endgroup\$ – feersum Nov 7 '14 at 9:35
  • \$\begingroup\$ @feersum: Yes, it is a rehashed version, but slightly modified - not sure if it can be solved similarly, though. \$\endgroup\$ – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 7 '14 at 9:38

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