# Print X without X (cop's thread)

This is the cop's thread of a challenge. You can view the robber's thread here

A pretty common beginner style question is to print some string, but there's a catch! You need to do it without using any of the characters in the string itself!

For this challenge, we will find out who is the best at printing X without X. There are two threads to this, a cop's thread and a robber's thread.

In the cop's thread (this thread), users will choose a language (which we will call Y) and a string (which we will call X) and write a program in language Y which takes no input, and outputs exactly X without using any of the characters in X. The cop will then post both X and Y without revealing the program they have written.

Robbers will select the cop's answers and write programs in language Y which take no input and output X. They will post these "cracks" as answers in their thread. A crack need only work, not to be the intended solution.

Once a cop's answer is one week old, so long as it has not been cracked, the cop may reveal their program and mark it as "safe". Safe answers can no longer be cracked and are eligible for scoring.

Cops will be scored by length of X in characters with smaller scores being better. Only safe answers are eligible for scoring.

## Extra Rules

You may be as specific or precise in choosing your language as you wish. For example you may say your language is Python, or Python 3, Python 3.9 (pre-release), or even point to a specific implementation. Robber's solutions need only work in one implementation of the given language. So, for example, if you say Python is your language, a robber's crack is not required to work in all versions of Python, only one.

Since command line flags and repls count as different languages, if your language is one of those then you should indicate that as at least a possible option for the language. For ease of use, I ask that you assume there are no command line flags in cases where command line flags are not mentioned.

You may choose to have your output as an error. If your intended solution does output as an error, you must indicate this in your answer.

## Find Uncracked Cops

<script>site = 'meta.codegolf'; postID = 5686; isAnswer = false; QUESTION_ID = 207558;</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>

• @user I believe errors are considered output, by our standard rules. I defer to those, so I believe the answer is yes. Jul 25, 2020 at 15:53
• @SomoKRoceS You can use any characters. Jul 25, 2020 at 21:03
• @Discretelizard I am not AdHocGarfHunter, but if your program does anything with the input (other than completely ignoring it), it is almost certainly invalid. Jul 26, 2020 at 15:09
• @EthanChapman Program flags are considered different languages. I had not thought if this initially so I will update the question but I will say that in order for command line flags to be used they should be explicitly allowed, either a specific flag or flags in general (as per the language vagueness rules). Jul 26, 2020 at 15:23
• @pppery Can the snippet deal with two submissions in a single post? Or should I make two answers and link them if I have a pair of highly related challenges? Jul 28, 2020 at 12:50

# Javastack, score 11, round 10, Cracked by exedraj.

dfhklmquvx"


Game on... One more time.

Up-to-date copy of the interpreter

I spent all day working on this, so hopefully it holds up for at least 20 minutes...

• no Aug 9, 2021 at 3:44

# Javastack, score 8, round 12, Cracked by exedraj

kdhmujvf


No more alphabetical order for you, sunshine!

Probably the last one, unless an unintended crack is found.

Up-to-date copy of the interpreter, with ES2020 stuff removed

• frick you Aug 9, 2021 at 5:58

# Javastack, score 9, round 13, Cracked by exedraj

kdsmujvfb


No more constants for you (except numbers and strings, so not really, but whatever)

Probably the last one, unless an unintended crack is found.

Up-to-date copy of the interpreter, with ES2020 stuff removed

My basic idea for rounds 11-13 was that you could use replace to concatenate two values with something like "string1" "string2" "xy" swap "y" swap replace swap "x" swap replace, replacing the x with string1 and the y with string2.

exedraj managed to get around this in round 11 because I had put the result in alphabetical order, so chars could just be removed from the ascii constant. This was exploited more in round 12, so I created this one and replaced ascii with char. However, this was exploited even easier.

exedraj's trick was to wrap the stack, stringify, and remove commas. I couldn't bypass this because even if I removed w, they could use pair pair pair pair pair etc for effectively the same result, and I needed all the chars in pair.

So, that's it for now.

# Vyxal, score 250, cracked properly by Aaroneous


!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVXYZ[\]^_abcdefghijmnopqrtuvwxyz{|}~¡¢£¤¥¦§¨«¬¯°±²µ¶¹»¼½¾×Þßæð÷øĊċėĠġİĿŀŻżƈƒƛǍǎǏǐǑǒǓǔȦȧȮȯɖɽɾʀʁΠβελτḂḃḊḋḞḟḢḣḭṀṁṄṅṖṗṘṙṠṡṪṫẆẇẊẋẎẏ‛„‟†‡•…‹›⁋⁰⁺⁼⁽₀₁₂₄₅₆₇₈₌₍€₴℅⅛←↑→↓↔↲↳↵⇧⇩∆∇∑√∞∧∨∩∪∴∵∷≈≠≤≥≬⊍⋎⋏⌈⌊⌐□⟇⟑⟨⟩꘍ꜝ  Frick you with your bullcrap inf. That stops now. No more inf. (at least, not easily). Edit: It took us a while, but we finally got there. Aaron got my intended solution 100%. • ... Oct 18, 2021 at 20:10 # JavaScript (V8), score 20 [+'"cv-0123456789*]  Good luck! This could be quite easy or quite hard. • Cracked. – m90 Nov 7, 2021 at 5:56 # Befunge-98 (FBBI), Score: 2, Cracked Not too difficult, but I don't think this can be made harder in Befunge. =,  My solution: 4b*:d0p'<1+1k @ • Cracked Jul 25, 2020 at 18:50 # Perl 5 + -p, Score: 30, Cracked Outputs to STDOUT. Perl has so many ways to generate chars so I've probably missed a few alternative cracks, but here goes... "'/0123456789<CMFQSV\^cmpqsv|~  • Cracked. Indeed I'm sure TIMTOWTDI. Jul 27, 2020 at 8:11 # Python 2, score 26 Cracked [2517630984, '\\"a_put']  The same as the output of this program. This may well get cracked fairly quickly so apologies in advance if I am not around promptly to acknowledge it! • This can probably be cracked via the unicode tricks used in the most-upvoted robbers answer. Jul 27, 2020 at 3:23 • @mypronounismonicareinstate In Python 2? Jul 27, 2020 at 3:24 • I haven't tried and do not know when that "feature" was introduced, so I may be wrong. Jul 27, 2020 at 3:25 • @mypronounismonicareinstate python.org/dev/peps/pep-3131 - introduced in 3.0 Jul 27, 2020 at 3:26 • Cracked Jul 27, 2020 at 4:17 # Java, Score: 2 (Cracked) Output (X): .  (a dot and a newline) Never golfed before, but saw this and couldn't resist trying; probably will be cracked within the hour, considering it's not really that complicated. My intended solution output to standard error. • Welcome to the site! Cracked, although it probably wasn't what you were intending. Jul 27, 2020 at 1:31 • For reference, there was a previous Java answer (now removed) by @user that used the Unicode character escaping trick -- you're probably going to have to include numbers, backslash, or 'u' in the answer in order to prevent this. Also, the newline doesn't make it any harder, since in Java you can just remove all newlines without affecting anything. Jul 27, 2020 at 1:34 • Never knew about that Unicode trick, should've looked up whether something like that was possible before posting. The newline was more a side-effect of the way I did it than actually intended to make it difficult. You're correct, that's pretty different from my solution. Am I allowed to repost/edit with a modified version that patches previous cracks? Jul 27, 2020 at 1:40 • I think you can repost a modified version – user Jul 27, 2020 at 1:58 • As the OP for the question I back up user's claim. You are free to post a modified version. Other's (including me) have already done that. Good luck! Jul 27, 2020 at 2:02 # Perl 5, Score: 35, Cracked "'/0123456789<CMPQSTVY\^cmpqstvy|~  Foiled in my last attempt I'll try another more restrictive set... • Cracked Jul 27, 2020 at 14:04 • @Gilles'SO-stopbeingevil' Nice work! I've got one last attempt to share but will have to be a much higher score! Jul 27, 2020 at 16:45 # Javascript (Browser), Score: 34. cracked ABDEFGHIJKLMNOPQRTUVWXYZ1234567890 Shouldn't be too hard compared to the other ones. • Welcome to the site! I've slightly edited your answer to fit the standard format used around here. Good luck, and hope you don't get cracked! Jul 27, 2020 at 21:20 • Cracked Jul 27, 2020 at 23:38 # Javascript (Browser), Score: 27 Cracked ABDEFGINOPQTUVYZ234567890tf[ • Cracked Jul 28, 2020 at 0:34 • If you're intending to submit a third cop answer with "ABDEFGINOPGTUVYZ234567890tf[evalsic", please do so as a separate answer. Jul 28, 2020 at 3:27 • ok. sure (stuff to fill the required characters) Jul 28, 2020 at 5:02 • Brony? Greetings (My username is formerly TwilightSparkle) – null Jul 28, 2020 at 13:26 # Javascript, score 6, Cracked (\SuC)  Alright, added 3 more characters. Same concept as before, but harder this time. My solution: []["fill"]["constr"+[[][0]+[]][0][0]+"ctor"]a${[]["fill"]["constr"+[[][0]+[]][0][0]+"ctor"]a${"ret"+[[][0]+[]][0][0]+"rn "+[[][0]+[]][0][0]+"nescape"}console.log%28"%28%5c%5c%53%75%43%29"%29} # Java, score 2 Cracked yC\  This is supposed to be printed to stdout. The y doesn't let you use System.out.println, the \ is so you don't use Unicode escapes, and the C is so you don't use reflection. This isn't super hard - I found it with my first Google search to make an answer to this question. • Cracked Jul 27, 2020 at 22:58 # Ruby, Score: 9, Cracked .'"?%([:<  My code outputs with no trailing newline and works for Ruby 1.8.7 onwards. By design, string creation is difficult. Edit: I've posted a new version hardened against the weaknesses found by @DomHastings and @Gilles'SO-stopbeingevil'. Because my code is almost unchanged I'll hold off on revealing it. • Cracked although I imagine this wasn't your intention... Jul 30, 2020 at 17:09 • @DomHastings Most definitely not! But isn't that Ruby + Bash? Jul 30, 2020 at 19:48 • Hmmm, yeah, I guess. Thought I was pushing it a little... Jul 30, 2020 at 19:59 • Using a shell escape works on Ruby on any POSIX platform, and the challenge allows cracks that only work on a specific implementation. So it's legit. Cc @DomHastings Dom's solution is a bit iffy because it requires bash, not just any POSIX platform, so it's a constraint on the presence of an external tool and not just a choice of implementation. Jul 30, 2020 at 22:51 • If you push an updated challenge that forbids backquote, be sure to also arrange to forbid putc which prints character by their numerical value. Jul 30, 2020 at 23:00 # Part 2: PicoLisp, score: 18 cracked Segmentation fault  or (similar): Segmentation fault (core dumped)  (output to STDERR) A bit harder than my previous answer. . . • Would this be considered a crack? The output shown there is correct (assuming it's been reproduced accurately), but running on TIO produces leading and trailing garbage. Jul 30, 2020 at 11:30 • @Dingus Almost, but that has spaces (it seems to work ). If it produces a Segmentation fault it's fine (with or without garbage) because if you run it as pil file.l it won't create garbage. If in doubt, see if you can install picolisp. Jul 30, 2020 at 13:13 • Ah yeah right... I completely overlooked the spaces! Segfaults without them too, though. Jul 30, 2020 at 13:25 • The output I get from pil for a space-free version of the code is Segmentation fault (core dumped). Not sure this is valid. Even if you allow the (core dumped) bit, my code contains both ( and )... Jul 30, 2020 at 13:36 • I can't reproduce this. When picolisp segfaults on my machine, it doesn't print anything, it just segfaults. If you're running it from a shell, the shell may print a message (depending on how it's configured, the locale, etc.), but this message does not come from the program. If the intended solution was to make it segfault, this is invalid for the challenge. Jul 30, 2020 at 22:46 # ><>, score: 17 - Cracked 0123456789abcdefo  I'm going to ban you from using numbers, too! What can you do now?! • That's just rude and mildly inconvenient. :P Aug 12, 2020 at 6:44 • @Lyxal So can you crack it? (It's not hard to anyone familiar with ><>.) – null Aug 12, 2020 at 6:45 • It was extremely inconvenient, but cracked lol Aug 12, 2020 at 7:28 # ><>, score: 19 0123456789abcdeflol  I could've made it 18 but just for the lols # PHP, Score: 1 Cracked ?  No command line flags were used. • Cracked! Aug 13, 2020 at 10:12 # PHP7, score: 15 (Cracked) funtim(){}_=/\~  • Cracked! Aug 19, 2020 at 9:09 # Setanta, score 3, cracked by Dingus Probably an easy one. N I  Here's my solution: n:=go_téacs(go_uimh("!"))[0]sp:=go_téacs(gníomh(a){})[1]i:=go_teacs(eas@mata(1000))[0]scríobh(n+sp+i)  • Cracked Aug 31, 2020 at 5:08 # AlphaBeta, score: 12, Cracked abcdefghijkl  I think this will get cracked quick, but I can't come up with anything else for AlphaBeta. • Cracked Nov 6, 2020 at 9:53 # LUA 5.1, Score: 22, Cracked ## Output 0123456789 "#$&'*+-/\a

• Cracked Feb 7, 2021 at 13:01

Gforth, 3 bytes





(That's a space, followed by a tab, followed by a newline)

• Cracked using a vertical tab. Feb 9, 2021 at 17:31

# x86 Assembly (gcc, Linux), score: 8, safe

Here is one for you x86 programmers.

Textual assembly, 32-bit x86 Linux.

RrL%ljJ.


• You can't use any assembler directives because . is banned.
• You are stuck in AT&T syntax
• You can't hand-encode instructions with .byte, .asciz, etc.
• Because you lack %, it is impossible to use anything that refers to registers.
• You have libc, but since you can't use CALL, JMP, Jcc, LOOP or RET, it is impossible to use.
• You can still INT $0x80, but since you can't refer to registers, it is impossible to set up. If you didn't already hate AT&T syntax, you definitely will now. 😈 The header to define the function is provided for you, as well as a template on TIO.  # String to print (w/o quotes): # "RrL%ljJ." # 32-bit Linux, glhf # theb$est(%syntax),%ever
.att_syntax prefix
.globl main
main:


TIO template

I actually wanted this to be cracked so I can post an eviler one, but whatever.

My solution: Try it online!

# ARM Assembly (GAS, Linux, no libc), score: 7, safe

Textual assembly, not machine code.

bpsBPS.


This makes it so you can't use bx, bl blx, push, pop, svc, swi, str, stm, syscall, mrs, or any assembler directives. Good luck trying to run a syscall or switch to Thumb. 😈

You can assume your code is placed under this exact header, so don't worry about declaring the function.

        .text
.arch armv5te
.arm
.globl _start
_start:


Should be pretty easy for those who are familiar with ARM's assembler. 🙂

My solution I can't get code blocks to work properly in spoilers, so here's a GitHub gist.

• Code blocks in spoilers can be made by prepending the first line of code with >!<pre><code>, prepending all subsequent lines with >!, and appending </code></pre> to the last. Example: if your code was a\nb\nc\nd\ne (with \n being a newline, of course; I can't put newlines in comments so this is the closest equivalent), you would type >!<pre><code>a\n>!b\n>!c\n>!d\n>!e</code></pre> (once again, with \n being a newline). Feb 3, 2021 at 23:08

# Rattle, Score: 35, Cracked

p
-
;
16.0112.01568.03136.021952.0


Note that there should be a trailing newline (technically it's impossible to do it without the trailing newline).

This should be relatively easy to crack...

As it's been cracked, here's my implementation - feel free to try to solve this a different way and teach yourself the language!

7|s[+]b*~,b*~*b*b*~b=+++++++++++++++++++++++++++++++++++++++++++++,++++++++++++++,

There is an online interpreter available here - all you need to do is replace what's in the "code" section and hit run (I would recommend minimising the header and footer as well). Do not modify the interpreter code (i.e. don't touch the Python code in the header and footer).

Good luck!

# Edit

I'm deciding to give out a small hint - try playing around with functions without arguments! Some functions have default values

• @EasyasPi I screwed up markdown, thanks for pointing this out. I'll edit it real quick Feb 11, 2021 at 3:29
• I assume this is a loophole, right?. (Interpreter code snipped because bitly hates me) 😏 Feb 11, 2021 at 4:25
• @EasyasPi yes, that is a loophole... I guess I should sanitise my inputs in the next update! Definitely a creative answer though! Feb 11, 2021 at 4:28
• @EasyasPi it looks like your answer still uses - though Feb 11, 2021 at 4:29
• I count only 35 bytes (including the trailing newline). Are there unprintable characters hiding in there? Feb 11, 2021 at 4:34

# Lua 5.1, Score: 35 Cracked

 !"#$&'*+-./:;<=>?@GaLl\0123456789  • I count only 35 characters. Has SE gobbled an unprintable? Feb 10, 2021 at 10:46 • Nope, you're right, its my bad. fixed Feb 10, 2021 at 16:26 • Cracked Feb 10, 2021 at 21:51 # Lua 5.1, Score: 50 Cracked ## Output  !"#$%&'*+-./0123456789:;<=>?@G\^ajklmpqvxyz{|}



Thats a TAB and SPACE at the beginning and a new line at the end. My code to produce that is 19542 bytes long in just 1 line. Thats my last try, cause once you come behind this you can come behind everything in LUA in this Thread.

Have fun :-)

• Cracked. Only 5152 bytes so I guess it's not your intended solution. Feb 13, 2021 at 3:23

# YaBASIC, Score:13 Cracked by Dingus

X: The string to crack:

0
1
2
3
4
5
6
7
8
9
A
a
-


The language may be Basic, but is the solution?

Y: The language - YaBASIC:

print "Can you crack it?"
`

Try it online!

• Mar 1, 2021 at 12:50
• @Dingus - OK, you got it pretty quick! That's a good solution actually. Give me a sec and I'll post a harder version for you if you're interested. Mar 1, 2021 at 12:54