74
\$\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 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>

\$\endgroup\$
28
  • 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
    Commented Jul 25, 2020 at 15:53
  • 1
    \$\begingroup\$ @SomoKRoceS You can use any characters. \$\endgroup\$
    – Wheat Wizard
    Commented Jul 25, 2020 at 21:03
  • 4
    \$\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\$ Commented Jul 26, 2020 at 15:09
  • 2
    \$\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
    Commented Jul 26, 2020 at 15:23
  • 1
    \$\begingroup\$ @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? \$\endgroup\$ Commented Jul 28, 2020 at 12:50

155 Answers 155

2
\$\begingroup\$

Keg, Score: 10 Cracked

doesn't\\`

This'll take some extra thinking for you all. Apparently not.

¶7ƛ;¶¶Z¶ⁿ2+¶`¶

\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – user92069
    Commented Jul 26, 2020 at 5:31
  • \$\begingroup\$ @Third-party'Chef' beat me to it by less than a minute :) \$\endgroup\$ Commented Jul 26, 2020 at 5:32
2
\$\begingroup\$

Befunge 93, score 12 (Cracked)

,0123456789"

Not too hard to figure out in theory, but a pain to implement (at least the way I did it).

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

Python 2, Score: 14 (Cracked)

"'0123456789dt

Note: There is no newline at the end

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. It was good fun. \$\endgroup\$
    – Wheat Wizard
    Commented Jul 26, 2020 at 17:38
2
\$\begingroup\$

Ruby, Score: 7, Cracked by @Dom Hastings

p<.$a1d

Attempt number 3 after being foiled by @nthistle and @Dom Hastings.

\$\endgroup\$
3
  • \$\begingroup\$ So I've got another crack, but I'm pretty sure it's still not the one you're expecting and I don't want you to get bored of having alternative cracks, so I'm looking for more alternatives... \$\endgroup\$ Commented Jul 26, 2020 at 18:51
  • \$\begingroup\$ I found another method, which could be a little closer perhaps? codegolf.stackexchange.com/a/207640/9365 \$\endgroup\$ Commented Jul 26, 2020 at 19:25
  • \$\begingroup\$ That was it! Nicely researched. \$\endgroup\$
    – histocrat
    Commented Jul 26, 2020 at 21:02
2
\$\begingroup\$

J, Score: 3 (Cracked)

Aiming for a low score, so might not be hard to crack. Blocks the straight-forward ways to convert a number to a character.

au.

Only tested with j9.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – nthistle
    Commented Jul 26, 2020 at 22:22
2
\$\begingroup\$

R (with CRAN packages installed), Score: 3, cracked

([{

Yes folks, no brackets!

You may assume that any CRAN package is installed, but as per standard rules not loaded.

I haven't posted an R version number although your solution might reasonably depend on that, I'm happy to accept an answer for any version of R after 3.0.0.

Update: this is possible without using any CRAN packages, but given I originally posted this allowing CRAN packages, I won't change it.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked (no packages needed) \$\endgroup\$ Commented Jul 27, 2020 at 12:23
2
\$\begingroup\$

J, Score: 3 (Cracked)

After nthisle cracked my previous challenge, here is a slightly harder challenge.

u:.
\$\endgroup\$
1
  • 2
    \$\begingroup\$ Cracked. \$\endgroup\$
    – Bubbler
    Commented Jul 27, 2020 at 14:14
2
\$\begingroup\$

R, Score=27, cracked by Dominic van Essen

We have had several R challenges on this thread already. All the solutions needed a t (for cat, get or other functions), so here is one where you will have to avoid that letter. I also threw in a v to forbid eval, as I don't really understand all of the magic you can do with eval...

t <-
"0123456789=[\\]^_`v"

\$\endgroup\$
7
  • \$\begingroup\$ I like that the output is perfectly fine R code, but now I'm definitely not going to get any work done today. \$\endgroup\$
    – Giuseppe
    Commented Jul 27, 2020 at 16:54
  • \$\begingroup\$ I've got a solution, but I won't have time to create all the numbers by making sum(T+T+...) for a while yet... \$\endgroup\$ Commented Jul 27, 2020 at 18:24
  • \$\begingroup\$ @DominicvanEssen Note that you are allowed *, which can make it easier to represent numbers. \$\endgroup\$ Commented Jul 27, 2020 at 18:48
  • \$\begingroup\$ That's a good point. I've posted an explanation of the crack now. I'll update it in a little bit by substituting in all the numbers... Hope it's Ok for now. \$\endgroup\$ Commented Jul 27, 2020 at 18:55
  • \$\begingroup\$ Good enough for me, well done! I should have disallowed more characters. My solution would allow for disallowing l and o as well; I'll probably post it tomorrow (but I don't want to flood this thread with rather similar R challenges!) \$\endgroup\$ Commented Jul 27, 2020 at 19:23
2
\$\begingroup\$

TSQL (SQL server), Score: 1, Cracked

X = (

I have made a post on meta which asks what is considered SQL output, but no answer yet. Feel free to consider my post cracked on either the result-set output (1x1 or 0x1 cells only though), or the print output (print/raiserror low severity). I am not including raiserror with high severity because OP said in case we use the error output we should say so, and I don't.

My first post here, feel free to edit if I missed anything.

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

Javascript (browser), score: 34

ABDEFGINOPGTUVZ234567890tf[evalsic

I am not going throw away my chance! Yes, I like Hamilton. (You may input code in the console).

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Answer is safe. \$\endgroup\$
    – PkmnQ
    Commented Aug 18, 2020 at 15:44
2
\$\begingroup\$

Ruby, Score: 23, Cracked

cdp0123456789.`'"?%([:<

Take 3, and hopefully this time I've better captured my intentions! The score has more than doubled over the previous iteration, largely thanks to the digits. Also now banned are c and d. For what it's worth, my code has hardly changed.

Previous challenges in the series:

Take 1 (score 9), cracked by @DomHastings. (@Gilles'SO-stopbeingevil' exposed another fatal flaw.)

Take 2 (score 11), cracked by @Gilles'SO-stopbeingevil'.

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

Ruby, Score: 16, Cracked

cdopr.`'"?%([{:<

OK, fourth and final take! The score has actually dropped now that I've realised (thanks to chief nemesis @Gilles'SO-stopbeingevil') that banning digits is redundant. But there will be no more String or Array (r), no more Float (o), and no more interpolation into regexps ({), thank you very much.

I'll surrender if this one is cracked . . . probably more like when this one is cracked :)

Previous challenges in the series:

Take 1 (score 9), cracked by @DomHastings. (@Gilles'SO-stopbeingevil' exposed another fatal flaw.)

Take 2 (score 11), cracked by @Gilles'SO-stopbeingevil'.

Take 3 (score 23), cracked by @Gilles'SO-stopbeingevil'.


My solution

I surrender. Here is my code:


 X = RUBY_COPYRIGHT
 D = RUBY_DESCRIPTION
 M = X=~/M/ && $&
 Y = X=~/Y/ && $&
 a = X=~/a/ && $&
 b = X=~/b/ && $&
 e = D=~/e/ && $&
 g = X=~/g/ && $&
 i = X=~/i/ && $&
 k = X=~/k/ && $&
 n = D=~/n/ && $&
 O = X=~/O/i && $&
 P = X=~/P/i && $&
 R = X=~/R/i && $&
 s = X=~/s/ && $&
 t = X=~/t/ && $&
 u = X=~/u/ && $&
 One = X=~/\w\w\w\w-/ && $&=~/^\w/ && $&
 thRee = X=~/\w-/ && $&=~/^\w/ && $&
 nine = X=~/\w\w\w-/ && $&=~/^\w/ && $&
 sPaCe = X=~/ / && $&
 DOt = D=~/\w\s\w\D/ && $&=~/\D$/ && $&
 lPaRen = X=~/\WC\W/ && $&=~/^\W/ && $&
 RPaRen = X=~/)/ && $&
 lsqbR = D=~/\S+$/ && $&=~/^\W/ &&$&
 RsqbR = D=~/]/ && $&
 take = DOt+t+a+k+e
 C = eval lPaRen+b+DOt+DOt+e+RPaRen+take+lPaRen+nine+RPaRen+lsqbR+One+RsqbR # eval "('b'..'e').take(9)[1]"
 S = eval lPaRen+lPaRen+M+DOt+DOt+Y+RPaRen+take+lPaRen+nine+RPaRen+lsqbR+thRee+RsqbR+DOt+DOt+Y+RPaRen+take+lPaRen+nine+RPaRen+lsqbR+thRee+RsqbR # eval "(('M'..'Y').take(9)[3]..'Y').take(9)[3]"
 PutC = P+u+t+C+sPaCe
 stRing = S+t+R+i+n+g+sPaCe
 suCC = DOt+s+u+C+C
 zeRO = eval stRing+One+lsqbR+One+RsqbR
 twO = eval stRing+One+suCC
 fOuR = eval stRing+thRee+suCC
 five = eval stRing+fOuR+suCC
 six = eval stRing+five+suCC
 seven = eval stRing+six+suCC
 eight = eval stRing+seven+suCC
 eval PutC+nine+nine
 eval PutC+One+zeRO+zeRO
 eval PutC+One+One+One
 eval PutC+One+One+twO
 eval PutC+One+One+fOuR
 eval PutC+fOuR+six
 eval PutC+nine+six
 eval PutC+thRee+nine
 eval PutC+thRee+fOuR
 eval PutC+six+thRee
 eval PutC+thRee+seven
 eval PutC+fOuR+zeRO
 eval PutC+nine+One
 eval PutC+One+twO+thRee
 eval PutC+five+eight
 eval PutC+six+zeRO

Try it online!

Explanation:

The basic idea is to build the output exclusively by extracting characters from predefined strings, then using those characters to build other necessary characters using eval.

I made the mistake of extracting characters from RUBY_COPYRIGHT and RUBY_DESCRIPTION, neither of which contain the essential c. If I'd used $LOADED_FEATURES, as @Gilles'SO-stopbeingevil' did, I would have had an easier time. I also made things difficult for myself by avoiding digits. Even had digits been banned (as they were in Take 3), they can be easily derived using $$.

RUBY_COPYRIGHT and RUBY_DESCRIPTION are strings (both added in 1.8.7) that both contain some fixed text and some version/platform-dependent text. For the Ruby version currently on TIO, these strings are as follows, with fixed text (common across all Ruby versions/platforms) indicated in bold:

RUBY_COPYRIGHT = ruby - Copyright (C) 1993-2019 Yukihiro Matsumoto
RUBY_DESCRIPTION = ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]"

I limited myself to extracting characters from the fixed parts of these strings so as not to tie the code to a particular version/platform.

I start out by grabbing a bunch of necessary letters through simple regexp matching, with the i flag used for case insensitivity to help with o, p, and r. I also grab the version-independent digits 1, 3, and 9, the space, . (for method calls), ( and ) (for grouping), and [, and ] (for indexing).

Now comes the tough part: I need a c to create either chr or putc (I used the latter) to convert numbers to their corresponding ASCII characters. I also need a way to create the remaining digits that I don't have, and sure enough the method to do that—succ—also contains c. (A synonym for succ is next, which I avoided because I couldn't get an x without using the platform-dependent x86_64-linux part of RUBY_DESCRIPTION.) Agonisingly, there are two (uppercase) Cs in RUBY_COPYRIGHT, but with no way to convert them to lowercase (you guessed it, downcase and swapcase also contain c) they're useless.

On top of that, I need an (uppercase) S to make String because succ (called via eval) ends up generating integers rather than strings.

After much wailing and gnashing of teeth, I realised that I had just enough characters to create take, fortuitously allowing me to extract c from the range ('b'..'e'). A double take was needed to get S from the range ('M'..'Y') (Matz's initials). See the comments in the code for a better idea of how this works.

With that out of the way, the rest is pretty straightforward. I make the putc, String, and succ methods by concatenating characters, use these to get the remaining digits, and then print the required characters.

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

SimpleTemplate, Score: 7 Cracked

This is just a simple one for you.

It outputs the following characters to STDOUT:

cho0.84

Should be a bit easy to find a working solution for this.


As you've seen, it has been cracked.
The code posted is a lot more complicated than I had written:

{@set x "a"}{@set k "{@in\x63 by 2251 x}{@in\x63 by -1 x}"}{@eval k}{@print "#{x}#{VERSION}"}

Simply starts x with "a" and increments it 2251 times.
Incrementing goes from "a" to "z", then "aa" ... "zz", "aaa" ... "chp".
Then, it decrements once (increments by -1), which results in "cho".

The line {@print "#{x}#{VERSION}"} just simply outputs the generated x and the VERSION variable, on a single string.
It's also possible to do {@print "%s%s", x, VERSION} for the same result.

\$\endgroup\$
3
  • \$\begingroup\$ I suspect this has to do with the print or php commands, but I'm not sure. Are you fine with plain PHP answers? \$\endgroup\$
    – user
    Commented Jul 30, 2020 at 16:09
  • \$\begingroup\$ @user The intended solution has nothing to do with PHP, but sure. As the challenge states, it doesn't have to be the exact solution I was expecting. So, go ahead, you can post your crack. But please specify that it is based in PHP. \$\endgroup\$ Commented Jul 30, 2020 at 19:35
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – Dingus
    Commented Aug 1, 2020 at 9:35
2
\$\begingroup\$

Perl 5.20 (packable with pp from PAR::Packer), Score: 87, Cracked

The ASCII control characters ^F^O^V^X and

!"%'(*+,-/0123456789:;<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\^`abcdefghijklmnopqrstuvwxyz{|~

As a Perl string:

"\x06\x0f\x16\x18" . '!"%\'(*+,-/0123456789:;<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ\\^`abcdefghijklmnopqrstuvwxyz{|~'

As hex:

060f161821222527282a2b2c2d2f303132333435363738393a3b3c3e404142434445464748494a4b4c4d4e4f505152535455565758595a5c5e606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7e

This means that the following printable ASCII characters are permitted:

 #$&).=?[]_

No more lists with =>, no more (balanced) parentheses. / is out but ? is back in.

My solution works with an ordinary Perl on Linux or Windows, and with any version of suitable vintage. My intent with the PAR::Packer constraint is to express that you shouldn't depend on how Perl is installed. You can run pp foo.pl and run the resulting executable on any machine that can run the resulting binary, even if it doesn't have Perl installed.

For information, my solution's size (I didn't attempt to golf):

$ wc perl-no-asterisk-braces-comma-parentheses.pl  
  40  148 3993 perl-no-asterisk-braces-comma-parentheses.pl

Continuation of:

  1. challenge, crack
  2. challenge, crack
  3. challenge, crack
  4. challenge, crack

I used several tricks that I got from Dom Hastings's solutions. If you're new to this series, you may want to read our explanations before tackling this one.

\$\endgroup\$
3
  • \$\begingroup\$ A little worried I'm not going to be able to get this as I'm away next week! I've got all the numbers, all uppercase characters, but still missing a generator for lowercase! I've looked into quite a few mechanisms, still investigating NaN... Hopefully I'll get some time Sunday... \$\endgroup\$ Commented Jul 31, 2020 at 16:00
  • \$\begingroup\$ @DomHastings After this one, I have another one ready with a slightly different character set that forced me to use a completely different approach to construct letters. And I'm also thinking about one without . — no more concatenation — but I haven't yet found an interesting character set that works. \$\endgroup\$ Commented Jul 31, 2020 at 21:52
  • \$\begingroup\$ Cracked! in probably the most horrendous way possible, but that was fun! \$\endgroup\$ Commented Aug 2, 2020 at 21:19
2
\$\begingroup\$

Dotty 0.20.0-RC1, score: 3 (Cracked)

:\{

Edit: Previously, I had the language marked as Dotty 0.20.0-RC1, but it appears there's an alternate crack(s) that also works on the latest versions of Dotty. This also means that you don't have to download Dotty 0.20, you can just test out your code in Scastie right in your browser.


Note: This The previous solution I had won't work before 0.20 or on the latest version (0.26 currently), so if you want to test it, you'll need SBT or Dotty 0.20 on your computer. However, you probably don't need to do that - just going through the Dotty website (linked above), and perhaps their GitHub repository should be enough. If you do want to test it, I'd suggest Scastie.


My original solution with Dotty 0.20:

 object Main with
   @main
   def main = print("" + 58.toChar + 92.toChar + 123.toChar)
 

But it turns just this works too, because functions can be toplevel in Dotty.

 @main
 def main = print("" + 58.toChar + 92.toChar + 123.toChar)
 


Hint: check the release notes for 0.20. There is also another feature, present since I think 0.18, that helps you do this. (To clarify, the first feature helps you avoid { and the second helps you avoid :, although the first can also help you avoid :).

Hint 2: The answer is very short and not at all complex (it took only 86 characters for me (no golfing)). Also, if you compile it on your computer, there will be 6 files: main.class, Foo$package.class, Foo$package$.class, and their corresponding .tasty files (assuming you name your file Foo.scala).

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

><>, score: 1 - Cracked

o

How can you output a character without using the o command?

Intended Solution

ab*1+:90p ;

Same trick, but much shorter.

\$\endgroup\$
2
  • \$\begingroup\$ cracked lol \$\endgroup\$
    – lyxal
    Commented Aug 12, 2020 at 6:35
  • \$\begingroup\$ @Lyxal Of course it's supposed to be easy lol also that one's poorly golfed see my intended solution \$\endgroup\$ Commented Aug 12, 2020 at 6:37
2
\$\begingroup\$

><>, score: 20

0123456789abcdef&loi

loi for loss of input

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

><>, score: 22

0123456789abcdef&loi'"

No literals now.

\$\endgroup\$
4
  • \$\begingroup\$ I"m just watching as your answers get progressively bigger and Lyxal still manages to crack them each time :) \$\endgroup\$
    – user
    Commented Aug 12, 2020 at 17:31
  • 1
    \$\begingroup\$ Well, you've won. I give up. It's just too hard for me to crack this answer................................is what I'd be saying if it wasn't cracked lol \$\endgroup\$
    – lyxal
    Commented Aug 12, 2020 at 21:25
  • 1
    \$\begingroup\$ @user I've struck again with my longest one yet. \$\endgroup\$
    – lyxal
    Commented Aug 12, 2020 at 21:26
  • 1
    \$\begingroup\$ @Lyxal For a moment there I felt a little sad, thinking this chain was going to stop. Good to see you haven't broken it yet. HighlyRadioactive, keep the challenges coming! I wish both of you luck. \$\endgroup\$
    – user
    Commented Aug 12, 2020 at 23:19
2
\$\begingroup\$

><>, score: 21

123456789abcdef&loi'"

Two ways.

\$\endgroup\$
2
  • \$\begingroup\$ roses are red, my name is not paul. where's round 8? cause this is cracked, lol \$\endgroup\$
    – lyxal
    Commented Aug 13, 2020 at 3:52
  • \$\begingroup\$ @Lyxal Herrings are red, my name is not Lyxal. I don't know ><> at all. Also, you are lazy. \$\endgroup\$ Commented Aug 13, 2020 at 4:11
2
\$\begingroup\$

Keg, Score: 55, cracked

  
 - + . 8  ! _ ~ ⑨ \ ;
  
 - + . 8  ! _ ~ ⑨ \ ;

View it online!

Good luck with this one. Most commands used to generate values are gone. Edit: I just realised the output was invalid. It's fixed now. Sorry about that.

\$\endgroup\$
6
  • \$\begingroup\$ Is the Try it online! link intended? :) \$\endgroup\$ Commented Jul 26, 2020 at 11:25
  • \$\begingroup\$ @mypronoun yes, it is. I copied the out in a new tio page to utilise its formatting. Also, it retains all characters SE might botch. \$\endgroup\$
    – lyxal
    Commented Jul 26, 2020 at 11:26
  • \$\begingroup\$ Cracked? \$\endgroup\$ Commented Jul 26, 2020 at 13:02
  • \$\begingroup\$ Is the official implementation linked required, or can the extended variants used in TIO allowed? \$\endgroup\$ Commented Aug 14, 2020 at 18:37
  • \$\begingroup\$ Nevermind, I don't need it anymore. \$\endgroup\$ Commented Aug 14, 2020 at 19:18
2
\$\begingroup\$

Javascript, score 80, Cracked

Last one for javascript. You have to do jsfuck, but I've disallowed 4 of the important characters. I left you some extra, but you'll have to figure out which ones to use and how to use them.

<("MrJock,TVQuizPHDBagsFewLynx.mRjOCKtvqUIZ=phd#bAGSfEWlYNX? 12+34-56*78^90%!')>

Yes, this is possible, by the way. The problems you will encounter, in order:

  • Making numbers (Notice in the number spot, I left out one operation, use that and one other symbol

  • Making booleans (The answer to this was posted years ago in a chatroom about JSFuck)

  • Executing functions (If you saw my previous two cop answers, you know how to do this)

My solution was exactly the same as the cracked one above.

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

Php7, score: 14 (cracked)

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

Python 3, Score 104 Cracked by dingledooper

Slithering deeper into Python insanity

$ python3 ./test6.py |hexdump -C
00000000  09 0a 0b 0c 0d 0e 0f 10  11 12 13 14 15 16 17 18  |................|
00000010  19 1a 1b 1c 1d 1e 1f 20  21 22 23 24 25 26 2a 2b  |....... !"#$%&*+|
00000020  2d 2e 2f 30 31 32 33 34  35 36 37 38 39 3a 3b 3c  |-./0123456789:;<|
00000030  3d 3e 3f 40 41 42 43 44  45 46 47 48 49 4a 4b 4c  |=>?@ABCDEFGHIJKL|
00000040  4d 4e 4f 50 51 52 53 54  55 56 57 58 59 5a 5b 5c  |MNOPQRSTUVWXYZ[\|
00000050  5d 5e 5f 60 61 62 64 67  6a 6b 6d 6f 71 73 75 76  |]^_`abdgjkmoqsuv|
00000060  77 78 79 7a 7c 7e 7f 0a                           |wxyz|~..|
00000068

This time it's not self-verifying.

Verification code:

import sys
import subprocess as s

fname = sys.argv[1]
ph = s.Popen(f"python3 {fname}",shell=True,stdout=s.PIPE)
out = ph.stdout.read()
with open(fname,'rb') as fh:
    fc = fh.read()

matches = [x for x in out if x in fc]

if len(matches) == 0:
    print("Success, no output characters in source")
else:
    print(f"Error, maching characters: {matches}")


Verify output:

$ python3 ./verify.py ./test6.py 
Success, no output characters in source

Original generator:

import re

code = "print(__dat)"

squots = re.compile("'([^']+)'")

dquots = re.compile('"([^"]+)"')

def fstrchar(x):
    return f"{'{'}chr({x}){'}'}"


def fy(x):
    return fystr(x.group(1))
    
def fystr(s):
    return f"f'{str().join([fstrchar(ord(x)) for x in s])}'"

def replaceliterals(x):
    xx = squots.sub(fy,x)
    return dquots.sub(fy,xx)

digits= re.compile("\d+")
def subdigits(x):
    return digits.sub(lambda m: f"len({repr(tuple([tuple()]*int(m.group(0)))).replace(' ','')})",x)

code = subdigits(replaceliterals(code))

dat = "".join([chr(x) for x in range(9,128) if chr(x) not in code])

ocode = code

code = code.replace('__dat',subdigits(fystr(dat)))

dat = "".join([chr(x) for x in range(9,128) if chr(x) not in code])

code = ocode.replace('__dat',subdigits(fystr(dat)))

open(1,'w').write(code)

Try the result online!

\$\endgroup\$
3
  • \$\begingroup\$ Note that newline (0a) appears twice in the output... \$\endgroup\$
    – M Virts
    Commented Jan 28, 2021 at 20:02
  • \$\begingroup\$ Also, period (2e) is in the output set, which may be overlooked because of the other periods used to represent non-printing characters. \$\endgroup\$
    – M Virts
    Commented Jan 28, 2021 at 20:13
  • \$\begingroup\$ Cracked, i think? \$\endgroup\$ Commented Jan 29, 2021 at 0:43
2
\$\begingroup\$

LUA 5.1, Score: 82 Cracked

Output

!"$%&'*+,-/0123456789:;<>?@ABCDEFHIJKLMNOPQRSTUVWXYZ\^`bdefgijklmnopqstuvwxyz{|}~

Little hints whats allowed at all

_Gachr.#()[]

I can reduce my score a lot by allowing more crap letters tho. This was a really fun task, code is brain fuck :D

Have fun guys

\$\endgroup\$
4
  • \$\begingroup\$ Is a trailing newline acceptable? \$\endgroup\$
    – Dingus
    Commented Feb 2, 2021 at 23:50
  • 1
    \$\begingroup\$ There's none in the output. \$\endgroup\$
    – LuaNoob
    Commented Feb 3, 2021 at 8:09
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – Dingus
    Commented Feb 3, 2021 at 9:41
  • \$\begingroup\$ Awesome @Dingus. New one is on the way soon. \$\endgroup\$
    – LuaNoob
    Commented Feb 3, 2021 at 10:34
2
\$\begingroup\$

x86 machine code (Linux, no libc), 1 byte, safe

Machine code this time, for 32-bit Linux.

0x80

Output is the byte 0x80 to stdout.

Your code cannot use libc. Specifically, expect it to be inserted into an ELF .o file linked as so (but the filename will not be used)

$ i686-linux-gnu-ld file.o -o a.out

My solution:

The easiest solution is to use sysenter instead of int 0x80. Try it online!

\$\endgroup\$
2
\$\begingroup\$

DOS x86-16 machine code, 1 byte, safe

0xCD

A similar challenge to my Linux one, this time for DOS. The solutions are entirely different, though.

In CP858/CP437, it is the box drawing character ═ (not to be confused with =), and in CP1251, it is the Cyrillic letter Н (not the English letter H).

That byte must be output to standard output. I won't accept writing to video RAM.

You can assume an i686-compatible CPU in real mode DOS.

I didn't make this obvious, but DOS has no memory protection. All RAM is fair game. Watch out for CPU cache issues, though.

I expected this to last no longer than a day, and clearly I was wrong.

My solution:

ba cc 21 42 52 68 b4 4c 52 b4 02 89 e5 16 55 cb

        org 0x100
start:
        // DX = int 0x21
        mov     dx, 0x21CC
        inc     dx
        // DL is also 0xCD.
        push    dx
        // mov ah, 0x4C (exit)
        // We can't use ret or int 0x20 because we
        // change CS.
        push    0x4CB4
        // Push int 0x21 again.
        // SP now contains this code, which calls
        // int 21 to print, then exits.
        //     int 0x21
        //     mov ah, 0x4C
        //     int 0x21
        push    dx
        // AH = 02 = putc(DL)
        mov     ah, 0x02
        // Copy SP to BP so we push the right value
        mov     bp, sp
        // dos doesn't protec
        // ez to attac
        // but most importantly
        // we can jump to stac
        // jmp far ss:[sp] if it existed
        push    ss
        push    bp
        retf
Too easy.

I am willing to write a sequel that requires even more DOS abuse if anyone is interested. But getting all these assembly cops for free is just boring.

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

YaBASIC, score:15 Cracked by Dingus

The new and improved string to crack:

0
1
2
3
4
5
6
7
8
9
L
S
l
s
-

Try it online in YaBASIC!

Can you crack it? Yes they can!

My method relies on 1 variable,i, which defaults to 0. !i (NOT i) results in 1. Of course, with 0 and 1 we've got binary - the building block of all computing. However, in my case I just added as many !i as needed to get the result. Pretty ugly...

?i
?!i
?(!i)+(!i)
?(!i)+(!i)+(!i)
?(!i)+(!i)+(!i)+(!i)
?(!i)+(!i)+(!i)+(!i)+(!i)
?(!i)+(!i)+(!i)+(!i)+(!i)+(!i)
?(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)
?(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)
?(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)
?chr$((!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i)+(!i))

And so on with ?chr$ and as many !i as needed for the desired character. In hindsight maybe adding = to the string would have slowed Dingus down by a few more minutes... Their solution uses it whereas mine doesn't. 😁

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – Dingus
    Commented Mar 1, 2021 at 21:07
2
\$\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\$
2
\$\begingroup\$

Javastack, score 15, Cracked once more by exedraj.

1234567890"dqwl

No add, no duplicate, no double, no random, no power - hopefully this will thoroughly bamboozle you.

Have fun!

I gave you back flatprint - you're gonna need it. Turns out you don't need it, and I'm taking away l.

\$\endgroup\$
1
  • \$\begingroup\$ Crockeried or something idk \$\endgroup\$
    – lyxal
    Commented Aug 7, 2021 at 11:16
2
\$\begingroup\$

Javastack, score 14, Cracked by exedraj

1234567890"crs

Game on.

Up-to-date copy of the interpreter

\$\endgroup\$
1
  • \$\begingroup\$ crocheted \$\endgroup\$
    – lyxal
    Commented Aug 8, 2021 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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