# 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 # Marbelous, 144 ## Code ______________________________++++++++++----......///0000000000000000111134477889::::::<<<<<<<<<<<=>>>>>>>>>>>@@@@@@AABLPTU\\\^^^^^^{{{{{{}}}}}}  _ represents a newline. ## Output 2.718281828459045  I'll probably regret leaving in so many numbers.. JS Marbelous Interpreter Unlike my other Marbelous cops, this one does not use cylindrical boards. # Brainfuck, 39 ### Code ++++++++++++++++++++------...<<>>>>[[]]  ### Output SOS  ## Python, 45 Code: ((((((()))))))+.1233445accehhiijlnnoprrrrsttv  Output: 0  Original print(eval((chr(43)+chr(45)).join(str(321)))) • Cracked – Sp3000 Nov 13 '14 at 21:40 ## Python shell: 21 chars A slightly beefed-up version of my previous attempt that I hope is harder to brute-force. 00112233445566778899^  Output (to shell): 15788895283  • Cracked. – es1024 Nov 16 '14 at 5:24 # Python, 51 bytes (SAFE) Code: ((((["tx*xx=2202022=xx*xt",prince:rinse+x*t]))));;;  Output: 86207823349459112201077150426144  Solution: x=2*2*2+2;exec("x=int(str(x)[:],0x20);"*x);print(x) Starting with x=10, interpret x as a number in base 32 and assign the result back to x. Repeat 10 times. • Works in both versions? – Martin Ender Nov 11 '14 at 8:22 • Just double checking - exactly one comma? – Sp3000 Nov 11 '14 at 8:46 • @MartinBüttner Yes, should work on any version (tested with 2.7 and 3.3). – DLosc Nov 11 '14 at 19:45 • @Sp3000 Exactly one. :) – DLosc Nov 11 '14 at 19:47 • Good old exec, the [:] did well to confuse. – Sp3000 Nov 18 '14 at 23:48 # Javascript size 13 (Cracked) Going for the shortest, runs on shell ([[])+]+[-}{] # Output "0"  • The question asks for programs. I'm not sure about the Python submission, but the JavaScript seems to require a shell. I don't know if that is allowed. (Also, different submissions generally go in different answers.) – Dennis Nov 4 '14 at 22:06 • @Dennis Both of them go into shells, I split them up. – Caridorc Nov 4 '14 at 22:08 • I count 13 characters. (And cracked it.) – Martin Ender Nov 4 '14 at 22:14 # Python, 68 (Cracked) ## Code """""""""#''''''(((((()))))),,,,,-0235;==CYbcdehilnooooooppprrrsstt{  ## Output #123456789  • Cracked - Think this should be the intended solution, or something similar at least – Sp3000 Nov 5 '14 at 7:18 ## PHP, 52 (Cracked) ### Code $)6am;crcn--+i(shr_4;9(na(%d_ ))t$2)o5tmrd(frhieo3=;  ### Output Wu]w.iB ZKlXV=(mYz(z,b,IlZ+Vi.J!5wMM6Dfa4N4^=]  • Cracked! – squeamish ossifrage Nov 5 '14 at 1:04 • Vi.?󠀠󠀠󠀠󠀠󠀠󠀠󠀠 – Vi. Nov 14 '14 at 2:09 # Python 3 size 54 (Cracked) (o'd)'op'/r),2\x'12.)w/)h],c'dp*((rx:(h('r'ol'ae#)[ere  # Output 'head'  • Does this have a print statement included or is it supposed to be run in a shell? – NinjaBearMonkey Nov 5 '14 at 4:27 • Run in a shell. No print statement. – Kyle Gullion Nov 5 '14 at 4:29 • – NinjaBearMonkey Nov 5 '14 at 4:33 • That works. Forgot about that pesky 'a'. – Kyle Gullion Nov 5 '14 at 4:37 # Perl, 39 (Cracked) ## Code //shredding($c_)=\\t_;$_=($r/~$p*2014);  ## Output H  Tested here • – grc Nov 6 '14 at 2:43 # ECMAScript, 29 (Cracked) # Code 1("HAlf PEnCesEveNthswunG".5)  # Output 32768  • Both this and your other submission seem to require a console/REPL environment, and are not full programs. – Martin Ender Nov 5 '14 at 22:52 • You're on your way to cracking them if you see it needs a javascript console. The definition of full program is important. – Cris Nov 5 '14 at 22:56 • I'm not sure how to understand that. I do have a solution that works in the console now. Is that valid, or is there an answer that does not rely on the result of an expression being printed automatically? – Martin Ender Nov 5 '14 at 23:44 • @MartinBüttner if it works in the console it's valid. I wouldn't preclude a solution I haven't imagined also working. – Cris Nov 6 '14 at 12:57 • Cracked. – Martin Ender Nov 6 '14 at 13:03 # Mathematica, 35 characters (Cracked) ## Code 'Pen & Pie Part Preprinters'====$$;  ## Output 0  Javascript: 47 chars (Cracked) //if("rest")("it will tell a surprise tale!")()  Output: a surprise!  PS: My original snippet does not contain any comments. Whoever takes a shot at this, try to crack that version. • Cracked – Optimizer Nov 6 '14 at 11:07 • – Scimonster Nov 11 '14 at 15:47 # Marbelous, 106 ## Code _________________________!!0000011122223779999:::<<<<<<<<<<>>>>>>>>>>AAAbb\\\/MMNNOOOOOO+++++QQ{{{}}}}}}~~  _ represents a newline. ## Output 3823160E090604030202  ## Hint Hexadecimal couplets. This output should hopefully look familiar to you. 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). # C++11, 121 [SAFE] ## Code #include <iostream> #include <cstdint> using namespace std; main(){{uint64_t b=-1,to(+'.');int uavlq(b);cout<<b-to,'d';}}  ## Output 2901942  ## Source #include <iostream> #include <cstdlib> using namespace std; main(){auto t=div('_nnt-',641);int b{'-,'};cout<<(t.quot+b);} Note that the answer uses cstdlib, not cstdint as given in the scrambled version. uint64_t does require C++11.... • I lol'd at swapping cstdlib for cstdint – Patrick Purcell Nov 27 '14 at 11:57 ## Python 2; 62 chars; Output: 100 chars; SAFE Code:  %%%''((((())))),-199;=[]___aaeeeeefggiiiillmnnnnooprrrstuv  Output: 1087654320987654316039744558401050205536516109500544976952359908183938933602037618678184519105773568  Solution: e='%ie%i';print long(sum([eval(e%(_,_-1))for _ in range(99)])) # CJam, 14 (Cracked) ## Code 1.2e35 6.78e9%  ## Output 108183.05975155532  • Cracked. – DLosc Nov 25 '14 at 18:11 # JavaScript, 36 scrambled code: trx=["bs","alie"];trx((x+x)guns(96))  output: ion RPL (HP48), 10 characters (safe) I thought RPL was out of the question, as discussed in my first and my second (deleted) submission. However, instead of creating a program object (with code enclosed in « », and possibly store it), I can just type the RPL code without « » and press Enter to execute the code immediately (kind of command line). For example, instead of creating the program « 1 2 3 + », I can just enter 1 2 3 + for immediate execution, and the output (addition to the stack) will be: 1 5  Now to the actual (reworked) puzzle that actually follows the rules. Because previous one did not follow the rules, the time for it starts now. (Unfortunately I can't post the other reworked puzzle now because I had already supplied the answer.) Code (to be entered for immediate execution): "DO PURGE"  No output (no change on the stack), also no error. Edit: I'm sure I've given enough time since helping with emulator information and documentation. So I'm now claiming immunity by posting the solution: "GUE" DROP Words DO and PURGE are the actual commands and I chose them because they deceive but provide the characters needed. PURGE will cause an error unless there is a name of an existing variable on the stack. Even if that's satisfied and the name is then taken off the stack, how will you get rid of ""? And how will you put a variable name on the stack without ''? It works if the variable doesn't exist, otherwise it gets evaluated. Of course, the behaviour would then depend on other factors, which should not be the case with any code in this contest. DO is for loops and would be incomplete, therefore cause an error (either run-time or syntax). • It's been about 8 1/2 days without any attempt being posted. In fact, for the last 10 days there have been no robber attempts at all. Is that the end of this pair of threads (and the contest)? I'm thinking whether I should post the solution and claim immunity as it doesn't feel like much of a win in complete absence of robbers... Also, this submission is not mentioned in the list of unsolved ones - does that still count? – Heimdall Dec 6 '14 at 0:19 • Are there interpreters/emulators or documentation for this language available online? – algorithmshark Dec 6 '14 at 5:40 • Yes, @algorithmshark. I've seen the emulator on Linux, I've got the Android one, there's plenty to find by searching "hp48 emulator". I'm pretty sure it's available for all major platforms. Here's the manual straight from the horse's mouth. Should I (with the spirit of this contest) extend my immunity claim to give people a proper chance as I have only just offered help with this comment? – Heimdall Dec 7 '14 at 18:17 # Assembly, 78 bytes, bootloader x86, GAS 00y v, :eylo1c1 e0.d xxx 1+m idt1ev 5.on ,xe%a .bt tb05=6d axa0.mh6a 50% o0  # output: a  # solution: .code16 d: mov 0x61,%al mov 0xe,%ah int 0x10 .=d+510 .byte 0x55 .byte 0xaa • At least you were kind enough to scramble the assembly, and not the machine code. :P – FireFly Nov 19 '14 at 19:07 • How do you set bl? I lack either a b or a , – mirabilos Dec 23 '14 at 14:19 # CJam, 47 bytes [safe] ## Code ###'''(())**+-0112333479:KKKKNNN]__cdffmtt{{}}~  ## Output 316218750702865:484776333:983474443201156009:7420206870:545426587396511674:49954383540:8793516242242  This should be hard, I guess... ## Hint It's not 7 numbers separated by :. The : in the code is for variable. ## Solution 'N)){~}:KK{1#1md'NNf-Kc((K*}93*]'0f+34_2#t3_7#t # Python 3, 21 [Cracked] Code pi.str.r42:():().[nt]  Output pi  # Java 8, 157 bytes. Prints HELLO. {ppt)i6s;ia.r eapxirf uw le([)i7{pt{7cdwo.,6aov viSjtrowbaor}avn6tS .imD,an}rtsia)eoerttt lt9((.eao[ut,E_tF9t7ge,e ejO.cbm}neiuiie7uiwFt2ri.ihc]no]cnys eanlc  ## Python 2, size 13 (Cracked) Code ex00123679///  Output 0.0068493150684931503  Original Source 6e1//073/0x92 • Edited to make heading formatted – mbomb007 Jan 2 '15 at 22:12 • I used repl.it – mbomb007 Jan 2 '15 at 22:14 • – jimmy23013 Jan 4 '15 at 15:55 # Ruby, 65 chars. code:  #think(((((())))))*++---./;;==^^^eeeeeeiiiiiimpssttu{|||}112569  (it begins with two spaces) output: 3 -7 -3 -3 -5 -4  (the output is separated by a new line) This one shouldn't be too difficult. Hint: This one relies heavily on bitwise operators, expecially or and xor Hint 2: Some of the parentheses are optional, not really required and are used only to confuse the "Robbers". # PHP, 484 chars s{9_aer{cmnef]3o"{hmotee]e)=o(mdo/_o sf[di=_{yi(e]9i/lho_o{n}"lt!og]bnek"}[.ec [""kebe=-r7")}.0l} ]e]"oe "3{]c_)ln[tee{u;rcr "cln{edu{eodo+(eoc"]docrcd]o e }0o}ll{oo)}no;{2tud;el#o.c$$0d dne{na[[ip2lcerihol dlH}+le [e [;l);[_"]d\.[]c$;n3d(]2$$:hitn"5d.i/tcepm["}noe "el[;;ex}Wx}}e"pe2o d ,<m)t<tt;l{pihldl \ cbye +1pi}[c]o lc c"]"(to}teued(]}l{[1e[d"}{)[e+ {e$$?il{">l nheb$)c$.ssbc\nusem;u$lpd=od)in {olsbnn{;}d76oy4sfc}}eicsd]i}xti$=f"ei{(o l\$n(;hc :coce dats(ei


output:

hello world


Hint:

The code is NOT platform dependent (tested in os x and ubuntu), although it won't work in ideone or any other online IDE.

Hint 2:

This code generates code in another language and executes it.

• You realize this is code golf, right? The goal is to have a short program. – mbomb007 Jan 12 '15 at 16:17
• I wanted to do something challenging and difficult to "crack". – user3807877 Jan 12 '15 at 18:49

## Python 2, size 23 [SAFE]

Using http://repl.it/

Scrambled

-/*[st0r3:.1245689])(()


Output

'110665.1105651'


Original Code

(str(065/.814)*2)[9:-3]
This takes the octal value 065 and divides it by .814 to create a longer decimal value. I then converted that to a string and repeated it twice by using *2. The final part takes a substring of that result, making it harder to know what went on.

## Python, size 30 [SAFE]

This one is just for fun, since my last one wasn't solved. :D
This one also has removed the workaround that squeamish ossifrage cleverly found. >:D
Still using http://repl.it/

Scrambled

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


Output

=> 'rot13'


Original Source

str(d for d in[])[9:6:~0]+13
I actually found this by accident. It creates a string of '<generator object <genexpr> at 0x221164>' (or some other address), then uses the rot at the end of generator and appends 13 to it.

# Insomnia, 14 (Cracked)

## Code

(Only 1 space, as seen below)

yes|grep-99 ii


## Output

101291340129


Interpreter

• – jimmy23013 Nov 22 '14 at 8:51

## Keg, length 7

Just for the fun of it.

5|(2&9)


Expected output:

2 5 2 2 2 2 2 2 2


Since new cop solutions are disallowed, I will just leak the answer:  5(9|&2) 

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