# Unscramble the Source Code

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.

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.

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

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

# 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̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

$(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> • @xnor Yes, that's what it means. – PhiNotPi Nov 4 '14 at 20:00 • You might want to forbid hashing... codegolf.stackexchange.com/questions/40304/… – NinjaBearMonkey Nov 4 '14 at 20:00 • 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? – user2023861 Nov 4 '14 at 21:54 • I thought "Oh, il just write a malbolge program, scramble it, and win this thing!". But then, i tried to write a malbolge program. – rodolphito Nov 5 '14 at 4:56 • Warning: Cops, do not use Ideone to test your submissions, as it stores your programs and other people can see them. – rodolphito Nov 6 '14 at 4:48 ## 242 Answers # C - 43 - Cracked ## Code: _main(_,su){_printf(&1+1+1+'1'),_TEA[0xD];}  ## Output 4  Tested with gcc • I've got a rather klunky solution for this one. – squeamish ossifrage Nov 5 '14 at 16:30 • @Allbeert: I think your submission should be disqualified, since it produces different result at different time (even if it takes weeks to for the result to change). – n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Nov 20 '14 at 19:16 • @n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳ Agree. I actually missed the "regardless of when/where it is run" requirement. However, since it was already cracked, I think deleting this answer at this point will not really be productive. – Allbeert Nov 27 '14 at 18:02 # PHP, Size 30 hill_top_101_(at)merchant.net;  Prints nothing with no errors, even when E_NOTICE is on. • What's that? Move the @ to the beginning and finished... This should be a challenge... – bwoebi Nov 5 '14 at 22:59 • I overlooked something... will edit in a minute. Edit: seems like since my old PHP version @ behavior has changed. But it's useless to the challenge anyway. – Tryth Nov 5 '14 at 23:02 • Cracked [that one is easy when you know the primitives to stop ;-)] – bwoebi Nov 5 '14 at 23:21 ## Lua, Size 49 =x)f+ nir +opxdnx5x7 e+ = =0)rx(d1.*1t)x1o(,(i21  ## Output 1103219.5489201  There are 6 spaces and no newlines. I wrote it in Lua 5.1.4 to be specific, but it should work for any version. # ECMAScript 6, 116 ## Code 1na.M.))wg)iae/l)2e(s}w1(wowo((s*)r7Ean p.(),e,t?=1ttulh+gnoed+lol>(.ccEe(1ui,+t2e-2(m,ean+eeh(.)2o1a/e:{a)-re7r3)e6 ## Output 747135.7188700009 # PHP, 33 (cracked by squeamish ossifrage) ## Code: (()),01;<=_eggghhhiiillnnrrssttt?  ## Output 52  ## Original <?=strlen(highlight_string(0,1)); Tested on all PHP between 5.2 and 5.5. # PHP, 44 (cracked by bwoebi) ## Code:  $$(())07;;=@[]____aacddeeeeghhilmnoprsssttw  Tested different PHP versions. ## Output (default for PHP 5.3.x, 5.4.x & 5.5.x), valid  Tested on terminal (-r), PHP file and online here. Notes: • You need at least PHP 5.3.0 or higher. • In some on-line testers it shows some warning, as it ignores @. • In some online testers it seems the output is seek instead for some reason (here), not sure why. At the same time it's a hint. Original: @_=get_class_methods(new phar);die(_[70]); • Cracked – bwoebi Nov 6 '14 at 14:34 # PHP, 21 (cracked by PleaseStand) ## Code: <?=9*8*7*6*5*4/3/2/1;  Tested on PHP 5.6. ## Output 14348907  ## Original <?=9**8/3;/**124567*/ • – PleaseStand Nov 6 '14 at 17:20 I tried cracking a few, but, NP-stupid-hard that this is, I didn't succeed. Instead, here's a C program: # C, 39 ## Code &&''((()))++9;;;<^____aaachiimmnnprtu{}  ## Output _^]\[ZYXWV  • This would be easy if I could rotate < into >. – feersum Nov 7 '14 at 5:37 • Cracked – feersum Nov 7 '14 at 6:29 ## Lua (again), length 28 -- Cracked There are no newlines, and 1 space. hit).na.iat1 aai=an(ms(p)r*p  ## Output 4.9348022005447  ## Javascript, 30 (())M^aaaehhiilmmnrtttwx  Output: 0  # Haskell, 42 (Cracked) gS{int S;S{ Shin=pr}=Sta S=vinow;mari}deda  output S  original code: data S=S{}deriving Show;main=print S;S{}=S  # Python, size 41[cracked by nneonneo] Scrambled: " "(()).01A\[]____aceeeeiillmnopprrrrttxx  Output: search  Tested on CPython 2.7.8 and 3.3.2, Pypy3 2.3.1 and Ideone. I'm not sure whether this is really easy or really unfair. • I've got a subset of the characters that prints search on Python 2 but I can't get rid of the other ones... – feersum Nov 6 '14 at 17:01 • @feersum That's interesting... I think I've copied it right without any spares though – Sp3000 Nov 6 '14 at 17:07 • I certainly don't think it's the same one. I tried it on Python 3 and got a different result. – feersum Nov 6 '14 at 17:08 • @feersum Hmm well if you can get it working somewhere verifiable (e.g. Ideone) then it should be okay – Sp3000 Nov 6 '14 at 17:09 • Cracked. For me this falls in the "really easy" category. – nneonneo Nov 7 '14 at 20:19 # CJam, size 13 (Cracked) ## Code ,/*#%CEffGIKs  ## Output 030819828850379075460427536222159187897761502517030034671154875945928930530907551421904962649729  I think this should be hard without brute-forcing. # Little Man Computer 63 characters long. Cracked by feersum [link]. This one may look overwhelming, but it's really easy to crack. You can find an online emulator (that uses Javascript) for LMC here. When writing the source, I made sure each "box" I used was padded to three characters with leading zeros. Source (original) Source (scrambled) 550780299002200104931956059169005996800195499090005297333101782  Output 51  • Cracked, I guess. – feersum Nov 7 '14 at 9:29 # Python, size 41 [cracked by DLosc] Scrambled: ""(())****666;;;;====ceeinprtxxxxxxxxxxxx  Output: 134713546244127343440523266742756048896  Since my short submission got cracked, I thought I'd submit a shorter (and fixed!) version of another one I currently have up. This might make it a lot easier, but who knows. • Cracked. That was fun. – DLosc Nov 8 '14 at 6:14 # Python 2, 29 bytes (cracked) (.;i;=)de mnoprrrsssssssttyyy  No output. • Cracked. – xnor Nov 4 '14 at 22:52 # Javascript, 82, [Cracked by Shawn Holzworth] Run in browser console, tested on Chrome 38 ## Code bbbbbbbbbbbbvv'''' 00001245667799[[[[[[[[[[[[((=+++++++/=/++++++=))]]]]]]]]]]]];;  ## Output u never find  • Cracked – SLuck49 Nov 7 '14 at 18:55 # ECMAScript, 90 # Code " "((((((()))))))+....;=FFFabcccdeeeffhhhiiiiiiilnnnnnnnnooooopprrrrsssttttttttttuuuuy{{}}  # Output function (){alert(this+"")} • @Sp3000 Nice work on the atob ones! – Cris Nov 9 '14 at 15:36 • – jimmy23013 Nov 9 '14 at 18:54 • @user23013 Nice work! – Cris Nov 9 '14 at 22:00 • @MartinBüttner amazing work on getting the exact solution. – Cris Nov 9 '14 at 22:01 # QBasic, 43 bytes (Cracked) Code: GRANT EACH SAME; DIST DAPPER 6; ID3 PEEP??  Includes 3 newlines. Output: ?? (Output is followed by a newline.) Tested on QB64. I'm quite positive this won't work on Repl.it or other online QBasic interpreters. • – jimmy23013 Nov 9 '14 at 11:57 # Marbelous, 107 Marbelous is rather fun to program in. ## Code ______________________!!***......000000000113444578:::::<<<<<=>>>>>>@@AAA\DDFF/////MM%%+++xxYYY{{{{{{}}}}}}  _ represents a newline. ## Output 110000FFFFEEEEDDDDCCCCBBBBAAAA9999888877776666555544443333222211110000FFFFEEEEDDDDCCCCBBBBAAAA999988  JS Marbelous Interpreter This requires cylindrical boards (i.e. marbles pushed off of the board on the left reappear on the right and vice-versa). # QBasic, 79 bytes (Cracked) One more, just for kicks: the meta-PPCG edition! Code: "Louis, I think this is the beginning of a beautiful friendship." - Rick Blaine  (Note the newline.) Output: Iodine  • – jimmy23013 Nov 10 '14 at 4:38 # QBasic, 37 bytes (Cracked) Code: PLAY "EN11E" R = INT(11873105*RND) ?R  The code above (which includes two newlines) runs just fine: it plays a cute little tune and then outputs 8377039.* Only one problem... Actual output:  8946304  As always, output is followed by a single newline. Original code:  PRINT 1801*5113 AND 1E7 R=LEN("RY?") * Tested on QB64 Windows 7 desktop version. The pseudo-random RND should give the same result every time the program is run, unless seeded by RANDOMIZE. It's likely that the particular result will be different on different systems. But in any case (spoiler alert!)--the unscrambled program does not depend on RND. ;^) • – PleaseStand Nov 10 '14 at 9:33 ## Python, 55 chars [Cracked] Works in both 2 and 3. ### Code ((()))**+,.0112589:={} ____aacdefgiiimmmnnnoopprrrrsttu  ### Output 108723934648156901437468808002  ### Solution The intended solution makes use of the fact that __name__ == '__main__' for scripts as well as in the REPL. More precisely, sum(map(ord,__name__)) == 801. print(sum(map(ord,__name__))**10+1) itforirngc={25.:89} • Cracked – Sp3000 Nov 11 '14 at 5:48 # JavaScript, 42 Cracked by Optimizer This should be pretty easy. ### Code tu curt infernnnnnnnnnno!(((())))+--58{||}  ### Output 1712  Run in browser console (result is REPL), tested in Chrome 38, Firefox 33, and IE11 ## Java - Size 97 (Cracked) Code ""''{{}}(((())))...345:;[]^_ BSSaaabbbcccdeeeefgggiiiiiiillmmmnnnoooprrrsssssstttttttttuuvwyy  Output X^Y  note: ends with a newline # Ruby, 23 (Cracked) code scramble: [[d++]8%-0]the...11 mops  output : "lice"  tested on: http://repl.it/languages/Ruby/ # C, 48 (Cracked) ## Code main(fma){fma=(0.9-'gpfx'),printf("%ddel",fma);}  ## Output -1378246  ## Original Solution main(f){f='ma'-lgamma(0xfe.dp9),printf("%d",f);} Pretty simple. • my attempt. I don't like it very much, but it fits too well to be a coincidence. – Art Nov 11 '14 at 12:08 ## Rust, 123 characters "{{{{{{{ - }}}}}}} > pgttts* ==== (((((%00xxeee,,: +miiiiiiiiii 999aa 222222! nnnnnnnn /o1))))) lffrrrrrrr3fff"  Output, no newline at the end: 97584  You may use Rust Playpen for experimentation if you don't have Rust installed. There is a hint: tr/gio_.ocupkzwwaaeeeeiiC/.ojdtkrnnlliic  ## Clojure, 96 characters (*(((+((([] (((=(=(( /[0]012222223999 adddeeeeffghiiiii mnnnnoopq rrrrr rstwxx)))))))))))))  Same output, same algorithm, same identifier names, same hint. ## Update This version is solved. I have posted the version 2. • Are warnings required / disallowed / irrelevant? – kennytm Nov 13 '14 at 12:12 • Original code does not produce warnings. It also does not contain comments, throw-away assignments or unused identifiers. – Vi. Nov 13 '14 at 12:33 • – kennytm Nov 13 '14 at 20:03 # DC (28) (cracked) ## Code: ++01111<[]ddlllnnnnsssssssx  ## Output: 13610152128364555  Source: Original: 1ss[lsd1+ss+dn11ls<n]sn0lnx Cracked: [ls+dn11ls1+dss<n]sn1ss0lnx Explanation This is made up of a macro [ls d 1+ ss + d n 11 ls < n] that is stored in register n. It loads the value from s, duplicates, it, adds 1 to it, stores that value back in s duplicates the value on the stack, prints that off (n is the print without return), and then compares register s with the value 11. If the value that was in s is less than 11, it invokes the macro stored in register n. A value of 1 is used to initialize register s and 0 on the main stack. The macro n is then loaded and executed. Sequence with spaces: 1 3 6 10 15 21 28 36 45 55 • – jimmy23013 Nov 13 '14 at 14:54 # Rust + Clojure, version 2 This is the second version of the task. The first version is here. Output, without the newline: 1283691742071510101818513212188161611241111219191910762714142222223591109301717171051225  There is a hint (the same as in version 1): tr/gio_.ocupkzwwaaeeeeiiC/.ojdtkrnnlliic  Now the task is more related to the hint compared to version 1. The algorithm is the same in Rust and Clojure versions, there are no comments, unused identifiers thow-away assignments. All identifier have 1-character names. ## Rust, 118 characters ====> -,,:!/""((((((())))))){{{{{{{}}}}}}}*%+++001111112235aaeeeeefffffgiiiiiiiiillmnnnnnnnnoprrrrrrrrsstttxxxx  ## Clojure, 106 characters == /(((((((((((((((())))))))))))))))[[]]*++00011112235adddeeefffgiiiiimnnnoopqrrrrrrrstxxxx  ## C, 128 characters <===== ,;;;;;;;/""((((((((())))))))){{}}*%%+++++001111112235adeeeffffiiiiiiiiiiiiimnnnnnnnnnoprrrrrrrrrrrrrttttttttuuuxxxx  ## Haskell, 83 characters ======|| _;;....((()))[]*+++011111122349aaddehiimmmMnoopprrrrrrsSttTuuvwxxxxx  ## Perl, 97 characters ===== ;;/..(((((()))))){{{{{}}}}}$$$*%+++011111122349beeeffffhiiiiiillnoprrrrrrrssssttuxxxx


## Shell, 170 characters

==                                 ;;;;;;;;;/((((((((((()))))))))))[[]]{}*%+++0111111111122349cccddeeeeeeeeeefffffhhhhhiiiiiiillnnnnnoooooopqrrrrrrssttt


Checked with dash, bash, ksh a zsh.

## protected by squeamish ossifrageJan 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).