64
\$\begingroup\$

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 count as different languages, you should indicate specific command line flags or the possibility of command line flags as part of your 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>

\$\endgroup\$
30
  • 1
    \$\begingroup\$ @user I believe errors are considered output, by our standard rules. I defer to those, so I believe the answer is yes. \$\endgroup\$ – Wheat Wizard Jul 25 '20 at 15:53
  • 1
    \$\begingroup\$ @SomoKRoceS You can use any characters. \$\endgroup\$ – Wheat Wizard Jul 25 '20 at 21:03
  • 3
    \$\begingroup\$ @Discretelizard I am not AdHocGarfHunter, but if your program does anything with the input (other than completely ignoring it), it is almost certainly invalid. \$\endgroup\$ – the default. Jul 26 '20 at 15:09
  • 1
    \$\begingroup\$ @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). \$\endgroup\$ – Wheat Wizard Jul 26 '20 at 15:23
  • 3
    \$\begingroup\$ Given the large number of answers to this challenge, I suggest adding the uncracked answers stack snippet to the question body, so it's easier to find uncracked cops. (I'm posting a comment rather than adding it myself due to the rule against adding leaderboards) \$\endgroup\$ – The Fourth Marshal Jul 27 '20 at 23:14

110 Answers 110

1 2 3
4
1
\$\begingroup\$

><>, score: 17 - Cracked

0123456789abcdefo

I'm going to ban you from using numbers, too! What can you do now?!

\$\endgroup\$
3
  • \$\begingroup\$ That's just rude and mildly inconvenient. :P \$\endgroup\$ – lyxal Aug 12 '20 at 6:44
  • \$\begingroup\$ @Lyxal So can you crack it? (It's not hard to anyone familiar with ><>.) \$\endgroup\$ – null Aug 12 '20 at 6:45
  • \$\begingroup\$ It was extremely inconvenient, but cracked lol \$\endgroup\$ – lyxal Aug 12 '20 at 7:28
1
\$\begingroup\$

><>, score: 19

0123456789abcdeflol

I could've made it 18 but just for the lols

\$\endgroup\$
1
1
\$\begingroup\$

PHP, Score: 1 Cracked

?

No command line flags were used.

\$\endgroup\$
1
1
\$\begingroup\$

PHP7, score: 15 (Cracked)

funtim(){}_=/\~
\$\endgroup\$
1
1
\$\begingroup\$

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)
\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$ – Dingus Aug 31 '20 at 5:08
1
\$\begingroup\$

AlphaBeta, score: 12, Cracked

abcdefghijkl

I think this will get cracked quick, but I can't come up with anything else for AlphaBeta.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$ – Dingus Nov 6 '20 at 9:53
1
\$\begingroup\$

LUA 5.1, Score: 22, Cracked

Output

0123456789 "#$&'*+-/\a

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$ – Dingus Feb 7 at 13:01
1
\$\begingroup\$

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

Here is one for you x86 programmers.

Textual assembly, 32-bit x86 Linux.

RrL%ljJ.

Your dilemma:

  • 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!

\$\endgroup\$
1
\$\begingroup\$

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.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ 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). \$\endgroup\$ – Makonede Feb 3 at 23:08
1
\$\begingroup\$

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

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

Lua 5.1, Score: 35 Cracked

Output

 !"#$&'*+-./:;<=>?@GaLl\`0123456789
\$\endgroup\$
3
  • \$\begingroup\$ I count only 35 characters. Has SE gobbled an unprintable? \$\endgroup\$ – Dingus Feb 10 at 10:46
  • \$\begingroup\$ Nope, you're right, its my bad. fixed \$\endgroup\$ – LuaNoob Feb 10 at 16:26
  • \$\begingroup\$ Cracked \$\endgroup\$ – Dingus Feb 10 at 21:51
1
\$\begingroup\$

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 :-)

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. Only 5152 bytes so I guess it's not your intended solution. \$\endgroup\$ – Dingus Feb 13 at 3:23
1
\$\begingroup\$

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!

\$\endgroup\$
2
  • \$\begingroup\$ Cracked. \$\endgroup\$ – Dingus Mar 1 at 12:50
  • \$\begingroup\$ @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. \$\endgroup\$ – Caleb Fuller Mar 1 at 12:54
1
\$\begingroup\$

Desmos, score 16, safe

0123456789pe[]{}

You don't have access to numbers, including pi and e, nor creating arrays, nor any functions that need {}. Since Desmos doesn't have strings, strings are generally outputted as character code arrays. You may be able to find some other suitable output method, but you don't need to. Good luck!

Safe: Huh, I shouldn't have used so many characters, I expected this to be cracked easily. There's a number of ways to get a 1, including but probably not limited to:

f(x)=x
f'(x)

and

floor(random())!

(note that we can't use ceil() as it uses e)

The former is what I used here. Once you have a 1, you can just add it a bunch of times and use a join() or two to make it into an array.

\$\endgroup\$
1
\$\begingroup\$

Dis, Score: 1, cracked by Dingus

{

I have never thought of constructing the program when I posted this.

PS. Rule clarification.

  • Output exactly a character whose codepoint is 123 in decimal integer.
  • Do not output else.
  • Then terminate the program.
  • No Dis implementation whose { command does putchar(codepoint of (a%256)) rather than putchar(codepoint of a); if your implementation is so, reguster A must be exactly 123 when { is executed. deleted as reference implementation, implemented in C, uses putchar(char) and char stores eight octets (maybe not on some machines).

Intended solution

*|||*__>*__>_||^___________________________*!**}}*! Try it online! Link to my interpreter, with comments. This uses that 123=11120t=1-11122t-11122t. To produce 1 I had to make 00100t first by 0-01020t-01120t-01120t. Then I did it > twice.

\$\endgroup\$
6
  • \$\begingroup\$ PS. I've just completed my program. \$\endgroup\$ – tail spark rabbit ear Jul 18 at 7:47
  • \$\begingroup\$ I don't follow the last bullet point: why does it matter how the { command is implemented? You say 'when { is executed', but { can't be executed in this challenge. \$\endgroup\$ – Dingus Jul 20 at 14:19
  • \$\begingroup\$ @Dingus; 1. Did I misread the specification? I couldn't see the specification that it outputs A modulo 256; or is it implicitly specified by reference implementation? 2. Outputting that character without using the character in your program is the point of my challenge. \$\endgroup\$ – tail spark rabbit ear Jul 20 at 22:19
  • \$\begingroup\$ I agree that the goal is to print { without using {, and that's the root of my question. If you can't use { to begin with, I don't understand the intent behind the last bullet point. Why does it matter how { behaves (mod 256 or not) if you can't use it? \$\endgroup\$ – Dingus Jul 21 at 2:30
  • \$\begingroup\$ @Dingus Deleted final bullet. \$\endgroup\$ – tail spark rabbit ear Jul 21 at 10:59
0
\$\begingroup\$

Dyalog APL, score: 53

BCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz⍙3

I don't know how long this will last

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$ – user Jan 29 at 0:57
0
\$\begingroup\$

Wolfram Language (Mathematica), Score: 47, cracked

abdfghijklmnopqrstuvwxyz
{ <-> , ~, &}[(*@)[]]

Fixed.

\$\endgroup\$
1
0
\$\begingroup\$

QBasic 1.1, score: 2, Cracked

Cc

I'm specifying QBasic 1.1 in order to exclude QB64 with its extra features. You can run it at Archive.org.

\$\endgroup\$
1
0
\$\begingroup\$

QBasic 1.1, score: 3, Cracked

C,c

POKE should be impossible now.

You can run QBasic 1.1 at Archive.org.


My solution:

 DIM outstr AS STRING * 3
 outstr = MKS$(908.6916)
 PRINT outstr
 

\$\endgroup\$
1
0
\$\begingroup\$

Gforth, 3 bytes

    

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

\$\endgroup\$
1
  • \$\begingroup\$ Cracked using a vertical tab. \$\endgroup\$ – EasyasPi Feb 9 at 17:31
1 2 3
4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.