# 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 ## 243 Answers # JavaScript, 73 ### Code console.log((((((('[[.....=-,,]]'+'02aaceeeeeefiiijllopprrrrssttv')))))))  ### Output denied  # Python 3, size 44 [cracked by feersum] Scrambled: print(((((((((((((()))))))))))))),,<<<<<<<~~  Output: 3  I'm trying to make Python look more like LISP. ## Explanation This one relies on Python's use of implicit conversion. ()<((),) evaluates to True, and applying << [bitshift] implicitly converts True to 1. • Cracked – feersum Nov 5 '14 at 13:46 • @feersum Fast :P – Sp3000 Nov 5 '14 at 13:47 # GolfScript, 20 bytes [safe] ## Code ...[[]]{{}}&%%++++5i  ## Output 32  Output does not have a newline character in the end. Inspired by this comment. ## Solution .{5i[+]+}.%{}++[.%]& # CJam, 19 (Cracked) ## Code JJ2334567899#%**~""  ## Output 500827930823087774653348  # Grass, size 134 [safe] ## Code WWWWwwWwWwWWWwWWWWwwwWwWwwwWwwwwwWWwWwwWwWWwWwwWWwwwwWwwwwWwwwWWwwwWwwwWWwwwWWWWWWWWwwWWwwwWwWWWWWwWWWwWWwwwwWWWwwWWwwwWwWWWwWwwwWWWWW  ## Output wwwwwwwwwwwwwww  Tested in the Python interpreter. ## Solution wWWWwwwwWwwwwwWwWwwwwwWwwwwwwwwWWwWWWwWWWWwWWWWWWwwwwwwWwwwwwwWwwwWWwWWWwWWWWwWWWWWWwwwwwwWwwwwwwWwwwWWwWWWwWWWWwWWWWWwWWWWWWwWWWWWWWw I wonder if anyone has tried... • This is straight up cruel. Good job. – Alex Van Liew Nov 14 '14 at 19:07 • Your program is safe now. You should post your code to protect your submission. – user10766 Nov 20 '14 at 5:49 ## Python 2 - 61 Cracked ### Code r~s]l][]:.c[():sit_'3-'(pt_trp.l]2-~n:][.i':o:p0Te[d_u1[.')i_  ### Output get  ### Original print''.__doc__[::2][::3].split()[1].split('.')[0][:-~-~True] • Cracked. – grc Nov 5 '14 at 3:27 • Outputs s> in Python 3.4 – CodeManX Nov 10 '14 at 11:23 • @CoDEmanX Yes, I wouldn't expect this to work in Python 3, which is why I specified Python 2. – FryAmTheEggman Nov 10 '14 at 13:36 # JavaScript, 31 bytes (SAFE) ## Code '([(102)])prenatal.gecko'tonsil  ## Output j  Should work in any browser console, although it is a standalone program. ## Original source alert('0acegnos'.link(top)[12]) The characters in the string are red herring, so it wouldn't be obvious what functions were used. It uses the little-known link function, which makes an HTML <a> element. The top object is converted to a string as [object Window], and added as the <a> link, the twelfth character of which is j. • Just double-checking, is the code missing a third o by any chance? – Martin Ender Jan 4 '15 at 14:08 • @MartinBüttner No it's not. – NinjaBearMonkey Jan 4 '15 at 16:08 • Very clever... maybe try for a shorter one now? – mbomb007 Jan 12 '15 at 19:05 # PHP, size 23 [Cracked] ## Code echo@$b=$b.$c,$c=$c.$c;  ## Output bbbbb  • Ah, that was unfortunate. I've got it now, but I can't submit again. – Martin Ender Nov 5 '14 at 15:53 • @MartinBüttner How did you then get it now? (Do you even know why it works?) – bwoebi Nov 5 '14 at 15:55 • well I just got it by experimenting a bit more. I don't get what I need the @ for, I have no idea why concatenating undefined constants work and I wasn't aware that you could have more than one $ in a variable name, but otherwise, it's pretty clear. ;) – Martin Ender Nov 5 '14 at 15:56
• @MartinBüttner the @ is just for avoiding notices. I wonder if there was another solution than my original, so I asked. – bwoebi Nov 5 '14 at 15:58
• – jimmy23013 Nov 5 '14 at 17:51

# JavaScript, length 32 (cracked)

alert('HaVobp'.match(/[HaVt]+/))


## Output

puGiXm


# CJam, size 19 (Cracked)

## Code

"Can't touch this!"


## Output

hunt 12tacos


(Probably not as difficult as the last one, but I had to post a sequel.)

• It's taco season - Elmer Fudd – FryAmTheEggman Nov 6 '14 at 15:42
• – jimmy23013 Nov 6 '14 at 15:47

# Golfscript, 32

## Code

  *++..0011125::::;;;?bbbbcccc{}


## Output

1993841993677373809355710590420516863199384199367737380935571059042051686311


# C, 70 (Cracked)

## Code

C='g'-pf;main(hx){ok,the(hot)Cake isA lie;forC*-g.=+:;prntf("%d",40);}


## Output

40135


## Original Solution

main(h,r){float C=h;ek:C+=0xA.ep4;if(h--)goto ek;printf("%g",C*'sd');}

• Cracked – feersum Nov 6 '14 at 6:28

# CJam, 34 bytes (cracked)

### Scrambled source

""Beware the Jabberwock, my son!""


### Output

1.0245778622239579

• Guessing its the same concept as Martin's – Optimizer Nov 6 '14 at 17:07
• @Optimizer: Certainly inspired by it, but hopefully much more difficult to unscramble. – Dennis Nov 6 '14 at 17:08
• The jaws that bite, the claws that catch! – Doorknob Nov 6 '14 at 18:50
• – jimmy23013 Nov 8 '14 at 10:16

# Ruby, 35

Code

}||{yyssplliihhddaa____][>====:.-)(


Output

shadilyshadily

• Methinks the scrambled code should have ended with >:-) – DLosc Nov 12 '14 at 2:07
• Cracked. – Martin Ender Nov 12 '14 at 11:48

# JavaScript, 69 Cracked by FireFly

### Code

grr('action rat')''(((())))*++++00001122333355566677====S[[]]ffffffxx


### Output

"nananananananananananana batman"


Run in browser console (string result is REPL), tested in Chrome 38, Firefox 33, and IE11

• @MartinBüttner Shoot, you are absolutely right (fixed) – SLuck49 Nov 12 '14 at 20:15
• Cracked. – FireFly Nov 14 '14 at 20:18

# Ruby, 43

Code

*+89*:%t(|in set{2e0--1e2}|*.prime?<~1)(25)


Output

11010100010100010100010000010100000100010100010000010000010100000100010100000100010000010000000100


Hint

The scrambled code (after the first few characters) describes the output. For each number in the set of natural numbers between 2e0 and 1e2 (2 to 100), output a 1 if it's prime and a 0 otherwise, for 25 primes in total.

Original Code

98.times{|e|print (2**e*~-5-1)%(e+2)<2?1:0}

Explanation

I learned this trick from leonid's answer on an Anarchy Golf problem. The code doesn't actually do a valid prime check, it uses the Fermat Primality Test in base 2, which is probabilistic but is correct up to 341 or so.

# C++11, size 104 [safe]

## Code

<<<<<<==>>  ,,,,,,;;:::::?.""(){}\&&##07aabcccccddddddeeeeehiiiiillllllmmnnnnooorrsssssttttttttttuuuux


And two newlines.

Compiled with g++ --std=c++11.

## Output

hello
hello
hello
hello
hello
hello
hello
hello
hello
hello


I thought I should have printed something better than hello.

## Solution

#include<iostream>#\><

struct u{int t=std::cout<<"hello"<<std::endl&&7;}l,d,s,c,b,main=d.t?exit(0),l:c;

Someone please explain how it works to me...

• I tried this one; I was unable to find the answer, but it inspired me to write this C program: #include <stdio.h> main(x) { bsearch("hello\n", &x, 1000, 1, printf); } – feersum Nov 9 '14 at 16:56
• Is there a trailing newline? – Mike Precup Nov 13 '14 at 0:10
• @MikePrecup Yes. – jimmy23013 Nov 13 '14 at 0:12

## PHP, 53 (Cracked)

### Code

o3o5do=++,"oodr=f(+$fni9$d;$9=d9$$%rp7<o$t=$);$,")5(;


### Output

571349220413226117734422843528553434864141775449210755731225661136475615328581707


# PowerShell 182 [safe]

### but definitely not the winner

''-join%{[char]};;|$()$a$a$a$c$c$c$_===+;    0-82,-82,-75,-70,-68,-68,-65,-15,-11,-11,-11,-11,-9,-7,-7,-7,-6,-6,-6,-2,-1,-1,0,1,1,7,8,8,8,11,13,13,13,15,21,25,48,65,79,80,80,80,80,80


# Output

Peter Piper picked a peck of pickled peppers


# Solution

$a = 0;$(80,21,15,-15,13,-82,48,25,7,-11,13,-82,80,-7,-6,8,-6,-1,-68,65,-65,80,-11,-2,8,-75,79,-9,-70,80,-7,-6,8,1,-7,-1,-68,80,-11,11,0,-11,13,1|%{$c=$a+$_;$a=$c;[char]$c}) -join ''

• You program is safe now. You should post your code to protect your answer. – user10766 Nov 20 '14 at 5:49

## JavaScript, 79 bytes [safe]

Another one, for fun. Might be similar to Shawn's 69 (at least I got the idea while working on it and not succeeding). Outputs using alert, which is already unscrambled for your convenience.

### Code

alert(0123)
//((((()))))++...3566777===[[[\]]]
//accefffgggghhhhiiklmnnoorrstuw


### Output

underhanded


### Hint

Here's a hint: think of substitution ciphers.

### Solution

for(f
in(g=/56732106737/.source+(h=[])))h+=g.link().match(/\w/g)[g[f]]
alert(h)

The digits in the regex pattern correspond to indices in the string g.link() aka <a href="undefined">56732106737</a>. "underhanded" uses only characters reachable by indexing with single-digit numbers into this string (most from "undefined").

## Perl - 26 bytes (cracked by choroba)

p:rlq{not goto p,if$a>=$b}


### Output

potato


# CJam, size 15 (Cracked)

## Code

6789%%%++:,{{}}


## Output

882


# Coffeescript - 96

There might be more than one way to solve this one. It's also pretty long, but hopefully it will survive cracking for a while.

Output:

5299944725070263763912242111215369742359896456157909233296841284031194827848086


Program characters: (note \n is a newline and \s is a space):

j\n][j9\sa='';]4j90].[.[i\n1].=iaa[]e]9i[9\sa]\s9t][ia2]n.8v\nan.fa=ar%,i\s1%=l+o.\s[09[j],+v%[\sroj,[9i.


Or without \n and \s:

j
][j9 a='';]4j90].[.[i
1].=iaa[]e]9i[9 a] 9t][ia2]n.8v
an.fa=ar%,i 1%=l+o. [09[j],+v%[ roj,[9i.

• In the scrambled code, I accidentally put a 2 instead of a 4... sorry about that. It's fixed now. – soktinpk Nov 5 '14 at 2:36
• I'm pretty sure it's impossible to crack some of these submissions with more than 50 characters. – soktinpk Nov 9 '14 at 22:26

# CJam, size 52 (cracked)

## Code

,,,,,;::::'""))@*\&%+++++333333333333333333ccffffffm


## Output

0!1"2#3\$4%5&6'7(8)9*10+11,12-13.14/15016117218319420521622723824925:26;27<28=29>30?31@32A


# Java - 70 bytes

.;{({([(pentagrams are cool)])})};. Sivintilituscimt Spunsimtsbuncyndt


output:

s


no quotation marks? What sorcery is this???

• Cracked – feersum Nov 7 '14 at 6:17

# C, 51 (cracked)

## Code

f;main(h,taxgpl) {for(c=90;c;c++) printf("%.d",h);}


## Output

8065


## Original Solution

main(h,dr){float c=+h+0xf.cp9;;; printf("%g",(c));}

• cracked – Art Nov 7 '14 at 12:36
• @Art congratulations! – es1024 Nov 7 '14 at 22:32
• I was trying to abuse argc being 1, but I hacked up my solution on a machine with clang and it refuses to accept non-standard definitions of main. It was a neat puzzle. I almost gave up after I spent two hours trying to do something like c=0xfbc; .. printf("%d", c + c + 9); but there was no "b". Was that on purpose? If so, it was a great tarpit. – Art Nov 8 '14 at 10:09

# C++, 192 chars (Cracked)

## Code

#include<stdio.h>
#define d double
(){return ;}(){return ;}int main(){printf("%.15f",));}       %(((((()))))****,,,,,,,,,,,-----..///000011122234477777::>??dddddfffggggiiiiiiiiiiinnttxxxxxxyyy


## Output

3.141592653589793

• Cracked – feersum Nov 8 '14 at 13:58

# QBasic, 42 bytes (Cracked)

I am having way too much fun here.

Code:

FAIR
N=PATERN"QBasic!"TIME 2 OR 1+1
HOUT N


... including 2 newlines. (This is written in a new dialect of QBasic that allows you to use nonstandard English, redundancy, and misspelled keywords as long as you tell the compiler that it's all FAIR.)

Output:

QBasic!
QBasic!


... including a trailing newline.

• – jimmy23013 Nov 9 '14 at 12:38

## JavaScript, 46 characters [Cracked]

This one is easy, so I expect it to be cracked quickly.

### Code

//terser code..


(includes newline)

### Output

ordered

• – PleaseStand Nov 10 '14 at 21:13

# JavaScript, 28 Cracked by Martin Büttner

Since my other submission was cracked, here's another.

### Code

eval(atob('[every thing]'));


### Output

1


Run in browser console (result is REPL), tested in Chrome 38 and Firefox 33