This is the cops' thread. For the robbers' thread, click here.
Cops' Task
- First, write a quine in a language of your choosing.
- Next, scramble the quine. Make sure to do this well as the robbers will be trying to unscramble it and find the original source code! Note that the scrambled code does not need to work.
- Post an answer on this thread. Include the language, the byte count, and the scrambled code.
Your program may not print to STDERR.
Here is an example of a cop submission:
Python, 29 bytes
nt _%=_r;_riinp;pr_='t _%%%_'
Robbers' Task
For the robbers' thread, click here.
Safe Submissions
If your submission has not yet been cracked after a week of posting, you may add the solution and specify that it is safe. If you do not, your submission may still be cracked.
Scoring
This is code-golf, so the user with the safe submission with the fewest bytes will be the winner of this section.
Leaderboard
Here is a stack snippet to generate a learderboard for this challenge. For it to display properly, please format your submission like this:
# Language Name, N bytes
... other stuff ...
If your submission gets cracked, please format like this:
# Language Name, N bytes, [Cracked!](link)
... other stuff ...
If your submission is safe, format like this:
# Language Name, N bytes, Safe!
... other stuff ...
<script>site = 'meta.codegolf'; postID = 5686; isAnswer = false; QUESTION_ID = 99469;</script><script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script><script>jQuery(function(){var u='https://api.stackexchange.com/2.2/';if(isAnswer)u+='answers/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJeRCD';else u+='questions/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJO6t)';jQuery.get(u,function(b){function d(s){return jQuery('<textarea>').html(s).text()};function r(l){return new RegExp('<pre class="snippet-code-'+l+'\\b[^>]*><code>([\\s\\S]*?)</code></pre>')};b=b.items[0].body;var j=r('js').exec(b),c=r('css').exec(b),h=r('html').exec(b);if(c!==null)jQuery('head').append(jQuery('<style>').text(d(c[1])));if (h!==null)jQuery('body').append(d(h[1]));if(j!==null)jQuery('body').append(jQuery('<script>').text(d(j[1])))})})</script>
-
7\$\begingroup\$ Closely related. (Same challenge except that answers didn't have to be quines.) \$\endgroup\$Martin Ender– Martin Ender2016年11月11日 17:54:39 +00:00Commented Nov 11, 2016 at 17:54
-
1\$\begingroup\$ Is the scrambled code supposed to also be a quine? Does it even need to be a valid program? I tried running the sample Python on codepad but it gets a syntax error. \$\endgroup\$milk– milk2016年11月11日 18:57:10 +00:00Commented Nov 11, 2016 at 18:57
-
\$\begingroup\$ @milk No, it doesn't need to be a valid program. \$\endgroup\$Oliver Ni– Oliver Ni2016年11月11日 18:59:41 +00:00Commented Nov 11, 2016 at 18:59
25 Answers 25
C#, 288 bytes
Stag is a great shoW. "="=""="="Agent"plastic"Was"tryin"to"Release"an"Astroid"."$Money$"st@le"tigers"and"Agent"plastic"got"mad"."$Money$"sic","man","t0tally"rad"."Sistrs"Rms"titAnic";"Civic"Ace"in"{sC@m}{hic}{vicis}..{cats}sAc}((@))((@)){{{>>{{{{{{}}}}}}}}}\\\\\\\;;;(@)((@)()),,;;
My strategy is for all the short ones to get cracked and nobody bothers with this considering how long it is... Also I suppose I should note that this is a full program, not just a function.
JavaScript, 1574 bytes, Safe!
I spent way too much time on this. Behold the obfuscation.
(notice that an unmatch parenthesis remains throughout the entire text.
dear "sir",
| i cannot express my loathing to you and your things. they truly are a loathsome sight. (regar'less of their quality, they function as the most appalling devices...)[1]
| these avocads of thine possession are most unpleasent. (ce n'est pas faux.) Queer; Careful; An' in total repulsing. in this form, those are not seulement cringe... So; CAB's is quite Cruel. (Cruel indeed...)
| intention is not great (heh, intention, ;}) run, no, run, since {tu est le ;AqC;};
{{{{============================================}}}}
[1]: see? am i not insane? You may dictate the opposite, so i dictate thus.
9 + 4 is 13. Y is this. Y + 4 is 9 + 9 minus one. N is this. f(x) is {x + x}, so f(N) is N plus N is N + N is 3.
:^) i'm cruel; not so cruel.)
rrrrrrrrrr 0nnnccnnggrrrrttssBBC
{({[}(<[<))(((((){{})}[}][[]{}(]))))|} f f r 0nnnccnngrrrrrttesBBA
())(((()))))()))()()()((((()))}{{})((} f f r 0nnnccnngrrrrrttesBBY
]]}(([][]{{{}}})()({}(){}{()}{}()[])][ f f r 4nnnccnngrrrrrttesBSY
))({})(}{)({{{{(()))())))))))()))()()( f f r 4nnnccnngrrrrrtpesqSY
)()()((((((((((Z))))))))()(()((()((((( f f r 5nnnccnngrrrrrtlefoSY
(((;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;''' f f r 3nnncccngrrrrxtleifSY
''''''''''''''''''',,,,,,,,[[[[[[]]]]] f f r 3nnncccngrrrrxtleifZQ
[ ] ] + + + + + + + + + + + + + + + ++ f f r 9nnncccggrrrrxtleifZQ
+ + + + too not fun...fffffffffffffuuu f f r 5nnncccggrrrrxtlli0ZQ
uuuuuuuuuuuu.. | | | |99S ) f f r 0nnncccggrrrrxxll01QQ
Here's the original source!
function Y(x){return x.charCodeAt()}; function Q(x){return String.fromCharCode(x)}; N=Array.prototype; function B(f,g,h){return function(){ return f(g.apply(h||this,arguments)); }}; function S(f,h){return function(){ return f.apply(h||this,N.reverse.call(arguments))}} function id(x){return x}; function format(){ args = N.slice.call(arguments); str = args.shift(); res = []+[]; for(i = 0; i < str.length; i++){ c = function(){return str[i]}; if(B(Y,c) == 95){ res += args.shift(); } else if(S(B)(c,Y)() == 94){ res += q = B(id,Q)(34); res += args.shift(); res += q; } else if(Y(c()) == 39){ i++; res += c() == ([][0]+[])[1] ? Q(10) : []+[]; } else res += c(); } return res; } console.log(format(Z="function Y(x){return x.charCodeAt()};'nfunction Q(x){return String.fromCharCode(x)};'nN=Array.prototype;'nfunction B(f,g,h){return function(){'n return f(g.apply(h||this,arguments));'n}};'nfunction S(f,h){return function(){'n return f.apply(h||this,N.reverse.call(arguments))}}'nfunction id(x){return x};'nfunction format(){'n args = N.slice.call(arguments);'n str = args.shift(); res = []+[];'n for(i = 0; i < str.length; i++){'n c = function(){return str[i]};'n if(B(Y,c) == 95){'n res += args.shift();'n } else if(S(B)(c,Y)() == 94){'n res += q = B(id,Q)(34);'n res += args.shift();'n res += q;'n } else if(Y(c()) == 39){'n i++;'n res += c() == ([][0]+[])[1] ? Q(10) : []+[];'n } else res += c();'n }'n return res;'n}'nconsole.log(format(Z=^,Z))",Z))
-
\$\begingroup\$
avocadscracks me up! \$\endgroup\$user41805– user418052016年11月14日 18:45:35 +00:00Commented Nov 14, 2016 at 18:45
-
\$\begingroup\$ Cracked \$\endgroup\$James Holderness– James Holderness2016年11月13日 21:01:37 +00:00Commented Nov 13, 2016 at 21:01
Underload, 20 bytes, Cracked!
~*)(a):*(*a:S(*S*~S)
I scrambled this via randomizing the order of the characters, because what could be more scrambled than random?
A correctly written Underload interpreter crashes when seeing a newline at the top level of the program. As usual in golfing competitions, there's no newline at the end of the program; I'm just placing this reminder here because it's very easy to add one by mistake when copying the program to an interpreter.
-
\$\begingroup\$ Welcome to PPCG! :) \$\endgroup\$Martin Ender– Martin Ender2016年11月12日 11:42:33 +00:00Commented Nov 12, 2016 at 11:42
-
2\$\begingroup\$ Well, I've been commenting indirectly on PPCG for a while by tracking down PPCG users on other forums (Reddit, IRC, etc.) and shouting at them until they post what I want. May as well do it directly :-) \$\endgroup\$user62131– user621312016年11月12日 11:46:50 +00:00Commented Nov 12, 2016 at 11:46
-
\$\begingroup\$ Cracked. Thanks, this was a fun challenge. :) \$\endgroup\$Martin Ender– Martin Ender2016年11月13日 13:13:42 +00:00Commented Nov 13, 2016 at 13:13
Retina, 20 bytes, Cracked
S`(\?)1円*
S`(\?)1円*
The program (and output) contains exactly two linefeeds.
You can try Retina online here.
A small hint:
In the process of designing this cop, I found a new shortest Retina quine, which I'll post to our quine challenge once this answer is either cracked or safe.
-
\$\begingroup\$ I'm going to guess that there's a dry run
*in there, and a\as a configuration option to prevent an additional linefeed. \$\endgroup\$mbomb007– mbomb0072016年11月16日 15:52:28 +00:00Commented Nov 16, 2016 at 15:52
CJam, 39 bytes, Safe
!""$)+023345679:AEORYZZ\_```bbceeffimmz
Solution:
")A!0z`eZOmRZ$Yei`E"_`32円fm95b67b43f+:c
Uses some base encoding for obfuscation. However, since the characters are all in ASCII I would have thought someone might be able to figure out32fm95b??b??f+:cwhich would be enough to brute force the rest.
-
\$\begingroup\$ I didn't know how to choose a permutation if I answered. Sorting is a good idea \$\endgroup\$Luis Mendo– Luis Mendo2016年11月11日 20:32:06 +00:00Commented Nov 11, 2016 at 20:32
Pyth, 38 bytes, Safe
Not quite golfed, but works.
````::""@@@@++++22ggKKKKKKKKNNNNZZZZ
Unsorted version:
K"K++@KZ:`K@`NZNgK2"++@KZ:`K@`NZNgK2
-
1\$\begingroup\$ I have a quine but it's missing two of the
@and one2... It's so close! \$\endgroup\$Steven H.– Steven H.2016年11月18日 21:38:06 +00:00Commented Nov 18, 2016 at 21:38 -
\$\begingroup\$ Quick ! You don't have much time ! \$\endgroup\$THC– THC2016年11月19日 10:12:37 +00:00Commented Nov 19, 2016 at 10:12
-
\$\begingroup\$ I think it's over. I can't figure it out... :( Congrats on getting a safe solution! \$\endgroup\$Steven H.– Steven H.2016年11月20日 00:20:05 +00:00Commented Nov 20, 2016 at 0:20
-
\$\begingroup\$ There you have the solution ! Out of curiosity, what was the quine you found ? \$\endgroup\$THC– THC2016年11月20日 10:37:47 +00:00Commented Nov 20, 2016 at 10:37
-
\$\begingroup\$ I had
K"K2:K@Kg`Z`Z++NKN":K@Kg`Z`Z++NKN. \$\endgroup\$Steven H.– Steven H.2016年11月20日 18:23:24 +00:00Commented Nov 20, 2016 at 18:23
Vim, 22 bytes, Cracked!
pit^[^[p00tqqqq^V"ltxltx"
The ^[ are the literal escape key, and ^V is Ctrl-V, and are therefore counted as one byte, and are kept together in the scrambled code.
-
1\$\begingroup\$ Cracked! \$\endgroup\$DJMcMayhem– DJMcMayhem2016年11月11日 20:17:32 +00:00Commented Nov 11, 2016 at 20:17
JavaScript, 147 bytes, Cracked by ETHProductions
I'll be very impressed if someone manages to crack this...
""""''''((((()))))+++++++++.//99;;;;;;=========>>[[[[[]]]]]``````````````cccdddddddeeeeeeeeeeeffiiiiiiinnnnnnnoooooooorrrrrrrrsttttuuwwwwwwx{{}}
Intended solution:
e=o=>{n=o;``[r=`constructor`][r](`return e=>{`+o+`}`)````};d=e+"";e`for(i in window)if(/ert/.exec(i))w=window[i];w('e='+d+';d=e+"";e'+d[9]+n+d[9])`
-
\$\begingroup\$ @ETHproductions Yeah, there's no
lforalertorconsole.log, nomforconfirmorprompt... Yeah I'm evil >:D Should I award a bounty to the cracker? \$\endgroup\$jrich– jrich2016年11月12日 19:44:23 +00:00Commented Nov 12, 2016 at 19:44 -
\$\begingroup\$ Well, there's this function that returns rather than alerting (and I'm pretty sure the OP's version worked like that to), and I could easily do the same to your solution... but is that legal? \$\endgroup\$ETHproductions– ETHproductions2016年11月12日 19:45:54 +00:00Commented Nov 12, 2016 at 19:45
-
\$\begingroup\$ @ETHproductions that would totally ruin it :( I'm going to say no, but if popular opinion dictates otherwise I guess that breaks most JS challenges \$\endgroup\$jrich– jrich2016年11月12日 19:48:48 +00:00Commented Nov 12, 2016 at 19:48
-
\$\begingroup\$ Yeah, I don't like return-quines, but I'm 99% sure there's no other way to crack that particular solution. I'll try to get a valid crack for yours though :) \$\endgroup\$ETHproductions– ETHproductions2016年11月12日 19:49:41 +00:00Commented Nov 12, 2016 at 19:49
-
\$\begingroup\$ @ETHproductions I may have made it a liiiiiiitle too hard in hindsight, but good luck! \$\endgroup\$jrich– jrich2016年11月12日 19:50:29 +00:00Commented Nov 12, 2016 at 19:50
Haskell, 86 bytes, cracked by nimi
putStr$"Study:ric====>>>>yummy:candy:circus:party:in:syrirrr!!!!!!$[;['=['[$]']='];]$"
This a valid Haskell expression which prints:
Study:ric====>>>>yummy:candy:circus:party:in:syrirrr!!!!!!$[;['=['[$]']='];]$
So if Ric studies, he can go to the yummy candy circus party! That is, if he figures out where Syrirrr is.
-
1
V, 20 bytes -- Safe!
"033ドルlpqxx|áäéééñññ
Note the trailing newline.
I wasn't really sure how to scramble them, so I just sorted the characters by ASCII value.
Unlike most V answers, this one contains zero unprintable characters. Here is a hexdump:
0000000: 2224 3033 336c 7071 7878 7ce1 e4e9 e9e9 "033ドルlpqxx|.....
0000010: f1f1 f10a ....
Unscrambled code:
éññ3äl0éé$áx3|"qpñx
Side not about this link. In previous versions of V, a newline was always automatically printed, which is why this version has the trailing newline. The interpreter at the time I wrote this was a valid quine, although now you can just remove the newline to make it valid.
Explanation:
éñ " Insert a 'ñ' character
ñ ñ " Put all of the following into register 'q' and run it when it's done recording
3äl " Make 3 copies of the character under the cursor
0 " Move to the first column
éé " Insert an 'é' character
$ " Move to the last column
áx " Append an 'x'
3| " Move to the third column
"qp " Paste register 'q' (all of the commands we just ran)
x " Delete a character
Haskell, 99 bytes, Safe
"super.quine?"=>#$$$%%%%%&&(())))**++++,,,,/;<<==>>STaabbdeffggghhhjlmmnoppqqrrsssttttuuuvvwwwwxxxx
Another Haskell quine, this time with a nice odd 99 bytes.
g%w=(g< $>w)++w++pure(g.last$w);main=putStr$pred%"h&x>)h=%?x*,,x,,qvsf)h/mbtu%x*qvuTus%qsfe&#"Try it on Ideone. The spaces in "g< $>w" must be removed, I put them there because otherwise the <,,ドル and> vanish (most likely being interpreted as html tag). The gibberish string is a string of the program with each char mapped to it's successor, including a final"(which is possible to include into the string without escaping because it's mapped to#). The helper function%takes the string and maps each char to it's predecessor usingpred(yieldingcode"), then appends the original string (yieldingcode"gibberish_code) and the last char of the decoded string (yieldingcode"gibberish_code"). To convert a charcto a string it would normally suffice to put it into a list[c]as strings in Haskell are simply char lists, however the successor of[is\, which would need escaping in the successor-encoded string, so insteadpureis used which lifts arbitrary types into a Monad (which Monad to use is inferred from the context).
-
\$\begingroup\$ Almost there. I have an additional
spaceand!, but don't know how to get rid of it. Nice idea, have a +1. \$\endgroup\$nimi– nimi2016年11月17日 15:25:04 +00:00Commented Nov 17, 2016 at 15:25 -
\$\begingroup\$ @nimi Tahnks, I'm curious what your approach did differently. \$\endgroup\$Laikoni– Laikoni2016年11月22日 13:21:22 +00:00Commented Nov 22, 2016 at 13:21
-
\$\begingroup\$ I had
g%w=g w++w++pure(last.g$w);main=putStr$(pred<$>)%"...#". So basically I failed to move the<$>into the function%. Now that I see your solution it's obvious. \$\endgroup\$nimi– nimi2016年11月22日 13:30:23 +00:00Commented Nov 22, 2016 at 13:30
PHP, 110 bytes, Cracked
php$=))$)<9 php .(().)'heroes ? 0ドル(9carrot3?$;<.()trash3,.((3=)catarrh$9ドル (,'9cry(3); ;;tryccchhhrrrrxxxxxx
-
\$\begingroup\$ You have a
carrot! \$\endgroup\$user41805– user418052016年11月11日 18:35:35 +00:00Commented Nov 11, 2016 at 18:35 -
1\$\begingroup\$ "... just for one day" \$\endgroup\$Luis Mendo– Luis Mendo2016年11月11日 18:43:46 +00:00Commented Nov 11, 2016 at 18:43
-
Javascript ES6, 49 bytes (cracked)
{{$((((((('`fuck rent =+> turn off fin`')))))))}}
Is it bad if I focused more on forming coherent words in the scrambled solution?
In any case, this is my first Cops and Robbers challenge.
Update: see comments for cracked code.
-
2\$\begingroup\$ Cracked. \$\endgroup\$ETHproductions– ETHproductions2016年11月12日 19:10:32 +00:00Commented Nov 12, 2016 at 19:10
FurryScript, 199 bytes, Safe!
UT TTEDU DT T U T D ES DGT GEL L GL
-<<<<<<+++++++[[[[#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#BESTQUINEEVER!#]]]]+++++++>>>>>>-
X XG WPW SS X PW S US WWTLWP XS PE
Should be fairly easy to crack.
Unscrambled Code
BESTQUINE[ DUP LT +SW +GT +< BESTQUINE#> ]
EVER![ DUP EX+ SW EX- LT +SW +GT +< EVER!#> ]
<BESTQUINE[ DUP LT +SW +GT +< BESTQUINE#> ]> BESTQUINE#
<EVER![ DUP EX+ SW EX- LT +SW +GT +< EVER!#> ]> EVER!#
Just the regular quine, but with two subroutines and some more code to swap the strings.
Vim, 17 bytes
<CR>""&(())::::\npps
The <CR> is Enter (^M or ^J) in the input and an added newline in the output. It is not the implicit end of file newline (see :help 'eol'). The 17 bytes are what is added to an empty buffer. (Newlines in a text editor are weird; let me know if this isn't clear.)
-
\$\begingroup\$ Cracked. \$\endgroup\$Martin Ender– Martin Ender2016年11月13日 17:03:25 +00:00Commented Nov 13, 2016 at 17:03
-
\$\begingroup\$ Cracked. It's somewhat questionable though whether a quine based solely on
gcounts as a proper quine. \$\endgroup\$Martin Ender– Martin Ender2016年11月13日 19:45:48 +00:00Commented Nov 13, 2016 at 19:45 -
\$\begingroup\$ I'm aware that this is a standard quining technique for Befunge, but as far as the rules of this community is concerned, the linked meta post is the accepted guideline for what counts as a quine. \$\endgroup\$Martin Ender– Martin Ender2016年11月19日 19:36:05 +00:00Commented Nov 19, 2016 at 19:36
Python 2, 105 bytes, Cracked!
######%%%%''(((((((())))))))****--0011::::;;==@@@@@@@@@@[[[[]]]]aaaaaaggggggiiiiiiiinnpprrrrrrrrrtt~~
The other one was cracked, so this one is more difficult.
print'To find the solution, get to work!'
-
-
\$\begingroup\$ @Sp3000 Oh gosh yeah, but I actually had an original quine doing something more than that. Anyways, you did it the lazy way :P \$\endgroup\$Erik the Outgolfer– Erik the Outgolfer2016年11月14日 15:14:21 +00:00Commented Nov 14, 2016 at 15:14
Ruby, 53 bytes - Cracked
**TEN sTupID,sTupID NET,"TIN"<22"DEN"<<It<DEtINDE\n\n
The \n are literal newlines.
-
\$\begingroup\$ Cracked. \$\endgroup\$Martin Ender– Martin Ender2016年11月16日 20:26:17 +00:00Commented Nov 16, 2016 at 20:26
QB64, 89 bytes
(_+cad:effecs:fact), =+cred:scarf:attaccd?, =+eff4c3d:cars:craccd?, (_+csc:f4c3d:fact), "
Some salient points:
- The code will not work in QBasic: it uses QB64-specific features
- Syntax expansion is off
- No dollar signs and only one quotation mark
- "Poetry" would be a stretch, but it does rhyme
Befunge-93, 24 bytes
I'm afraid this is a bit late, but I wanted to attempt one without the g command.
<<_:@00278899p,**++###>!
OIL, 77 bytes, Safe
0
0
1
1
1
1
1
1
1
1
1
2
2
4
4
4
6
8
10
11
11
11
12
17
18
18
18
18
22
26
26
32
Good luck with that.
Solution, "commented" (remove comments before running or it won't work):
0 # nop twice
0
1 # copy element from cell 1 to 1 (so do nothing again)
1
1
4 # print what's in cell 1 (a zero)
1
11 # print a newline
4 # and the same thing again; printing zero and a newline
1
11
1 # copy what's in cell 2 (a 1) into cell 2
2
2
1 # copy what's in cell 12 (two lines before; a 2) into cell 18
12
18
10 # check if the value in the cell of the following line (starting with 2; we'll jump back here)
18 # (this is cell 18)
1 # is equal-ish to the one in cell 1 (a zero)
32 # if yes, jump somewhere
22 # otherwise jump one cell ahead
1 # copy what's currently in cell 18 (first a 2) into cell 26
18
26
4 # print cell 26
26
8 # increment cell 18
18
11 # print a newline
6 # and jump back to cell 17
17
So to summarize, it works by first printing two zeros, and then comparing every line starting with the third one with zero, and if it isn't zero, printing it, else exiting (since OIL reads zero from any empty/non-existent cell). Any variable lines contain the value they have when they are printed (since I'm lazy, I obtained this by first making a near-quine where those cells have some arbitrary non-zero value, and using the result, which is a quine).
-
\$\begingroup\$ Cracked... \$\endgroup\$Martin Ender– Martin Ender2016年11月13日 15:42:50 +00:00Commented Nov 13, 2016 at 15:42
-
\$\begingroup\$ @MartinEnder Of course!! I didn't except this to last for 1 minute at all, though. And I expected Dennis to do it first, but nevermind. \$\endgroup\$Erik the Outgolfer– Erik the Outgolfer2016年11月13日 15:44:12 +00:00Commented Nov 13, 2016 at 15:44
-
\$\begingroup\$ To downvoters: This just had to be posted. \$\endgroup\$Erik the Outgolfer– Erik the Outgolfer2016年11月17日 08:33:03 +00:00Commented Nov 17, 2016 at 8:33
Explore related questions
See similar questions with these tags.