30
\$\begingroup\$

This is the robber's thread of a challenge. You can view the cop'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 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 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 be select cop answers and write programs in language Y which take no input and output X. They will post these "cracks" as answers in this thread. A crack need only work not 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

Robbers will be scored by the total number of successful cracks with more cracks being better.

\$\endgroup\$
  • 1
    \$\begingroup\$ Congrats on an excellent challenge with high 'replay value'. I've had a lot of fun participating on both sides, digging into a couple of languages for the first time along the way. \$\endgroup\$ – Dingus Aug 20 at 3:22

84 Answers 84

1 2
3
2
\$\begingroup\$

PHP 7, 46 bytes, cracks thelmuxkriovar's second answer

<?php echo"      crACked??"^"FUNTIMK[:>4XKcA";

Try it online!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ you're too fast lol, good job, this was similar to the solution I initially came up with \$\endgroup\$ – thelmuxkriovar Aug 19 at 9:12
  • \$\begingroup\$ @thelmuxkriovar Yeah, apologies! I think I was there at the right time and had alraedy prepared the other answer when I looked at your first :) \$\endgroup\$ – Dom Hastings Aug 19 at 9:18
  • 1
    \$\begingroup\$ 25 seconds from cop to crack - must be a record! \$\endgroup\$ – Dingus Aug 21 at 5:06
2
\$\begingroup\$

Setanta, cracks @bb94's answer

scríobh(go_téacs(go_uimh("a"))[0]+go_téacs(scríobh)[1]+go_téacs(cmhcht@mata(10,1000))[0])

Try it

This was harder than I expected. After reading the docs and poking around in the source I couldn’t find an obvious way to do any of the following: (i) convert ASCII codes to characters, (ii) create character ranges, (iii) convert text to uppercase, (iv) use octal/hex escapes, (v) get uppercase characters from names of built-ins/predefined variables, (vi) increment/decrement a string, or (vii) call an equivalent of eval.

Things were looking pretty hopeless until I somewhat accidentally discovered that calling go_uimh (convert numeric string to number) on an alphabetic string yields NaN. Could I grab the N from NaN? Yes, by first converting NaN to text with go_téacs, then indexing into the string.

The space was comparatively straightforward. There's an example in the tutorial that shows what happens when go_téacs is called on a gníomh (literally, action; equivalent to a method/function in other languages): go_téacs(scríobh) == "< gníomh scríobh >". The space is extracted by indexing into this string.

Now for the I. Following my experience with NaN I had a hunch that I was looking for a way to generate Infinity. Sure enough, cmhcht@mata(10,1000) (which attempts to calculate \$10^{1000}\$) does just that.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Scala, cracks @user's answer

println{"" + {40 toChar} + {46 toChar}}

Try it online!

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Cool! Never thought about braces. I defined a function taking a single argument and used infix notation \$\endgroup\$ – user Jul 25 at 17:38
  • 1
    \$\begingroup\$ Yeah, my immediate thought when I saw (. was postfix notation -- spent a while trying to figure out why println 3 wasn't working when I stumbled upon the braces trick. \$\endgroup\$ – nthistle Jul 25 at 17:44
  • 1
    \$\begingroup\$ By the way, you needn't mark it as (repl). Just wrap an object Main extends App {} around it (it's what I did). \$\endgroup\$ – user Jul 25 at 17:56
  • \$\begingroup\$ Ah, thanks, I'll update the TIO link. \$\endgroup\$ – nthistle Jul 25 at 17:58
1
\$\begingroup\$

05AB1E, cracks @SomoKRoceS's answer

46ç

Try it online!

Pushes 46, then converts to a character, with implicit output.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Keg, Lyxal's answer

f;;p;f;r⑨m⑨ 7+u;Z⑨⑨:a;

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Befunge-98 (PyFunge), 37 bytes, cracks pppery's answer

This code is terrible.

"NRTS"4(0"<"1+D0"r"1+D0"o"1+D0"+"1+D@

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Keg, 264 bytes, cracks Lyxal's answer

Uses the -oc flag.

‡32‡32‡10‡32‡45‡32‡43‡32‡46‡32‡56‡32‡7‡32‡33‡32‡95‡32‡126‡32‡9320‡32‡92‡32‡59‡10‡32‡32‡10‡32‡45‡32‡43‡32‡46‡32‡56‡32‡7‡32‡33‡32‡95‡32‡126‡32‡9320‡32‡92‡32‡59‡10

Try it online!

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Doesn't seem to replicate the 0x07s and trailing newline in the original question (see the TIO link there), but I would imagine that's easily fixable. If it's not, I have a different solution I can post. \$\endgroup\$ – Ethan Chapman Jul 26 at 14:00
  • 1
    \$\begingroup\$ Indeed, it doesn't; I'm not sure how that happened (probably an issue when copying a nonprintable); fixed. \$\endgroup\$ – the default. Jul 26 at 14:18
  • \$\begingroup\$ I never used flags in the original, hence this is an invalid crack. \$\endgroup\$ – Lyxal Aug 13 at 4:58
  • \$\begingroup\$ @Lyxal it doesn't matter if it's not intended \$\endgroup\$ – the default. Aug 13 at 6:11
  • \$\begingroup\$ It does. I just got told a crack was invalid for using flags when the original program didn't use them. \$\endgroup\$ – Lyxal Aug 13 at 6:23
1
\$\begingroup\$

Java, cracks @user's answer

import java.io.*;

public class Main {
    public static void main(String[] args) {
        PrintStream out =  new PrintStream(new FileOutputStream(FileDescriptor.out));
        out.println(""+(char)121+(char)67+(char)92);
    }
}

Try it online!

There's more than one way to get standard out (although the FileDescriptor reference needs to be converted to a PrintStream first).

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ 👍 This is exactly how I did it \$\endgroup\$ – user Jul 28 at 0:43
1
\$\begingroup\$

Javascript, cracks PkmnQ's answer

Target: (\SuC)

In browser (tested on Chrome):

atob['constr'+`${!0}`[2]+'ctor']`$${'console.log'+atob`KA==`+atob`IihcXFN1QykiKQ==`}$```

In Node:

U=`${!0}`[2];global['F'+U+'nction']`$${global['B'+U+'ffer'].from`99${''}111${''}110${''}115${''}111${''}108${''}101${''}46${''}108${''}111${''}103${''}40${''}39${''}40${''}92${''}92${''}83${''}117${''}67${''}41${''}39${''}41`}$```

Try it online!

OP already revealed an important trick (running arbitrary code in JSF$ck), so it was just a matter of creating the required chars from something else. Browser version uses base64 decoding function atob, and Node version uses Buffer.from, which luckily takes an array of numeric strings as an array of bytes.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Honestly, I didn't think of using atob. I used (again) unescape. \$\endgroup\$ – PkmnQ Jul 28 at 10:33
1
\$\begingroup\$

T-SQL

DECLARE @String VARCHAR
SELECT @String = 0x28
SELECT @String

Outputs ( but doesn't contain ( by using implicit type coercion.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Nice. I did the same but just in a more complex way \$\endgroup\$ – George Menoutis Jul 28 at 20:31
1
\$\begingroup\$

Ruby, cracks @Dingus' answer, 77 bytes

I imagine this is almost certainly not the crack in mind, but this was the other solution I found before posting the crack for @Histocrat's second cop.

print`echo -n \x27\x2e\x27\\\x27\x27\x22\x3f\x25\x28\x29\x5b\x5d\x3a\x3c\x27`

Try it online!

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ This requires Ruby+bash, not just Ruby-on-Unix. But the same principle works with Ruby-on-Unix: use printf \\047... instead of echo \x27…. \$\endgroup\$ – Gilles 'SO- stop being evil' Jul 30 at 22:57
  • \$\begingroup\$ I've posted a fortified version so will hold off on revealing my solution. \$\endgroup\$ – Dingus Jul 31 at 4:47
1
\$\begingroup\$

PicoLisp, cracks @Wezl's answer 5 bytes

Marking this community wiki as @Dingus Googled the error and found a solution and I applied the previous crack's style and removed bits.

[[0]]

Try it online!

| improve this answer | |
\$\endgroup\$
  • 2
    \$\begingroup\$ Unless there's a version of PicoLisp that does something bizarre, this doesn't work. [[0]] causes picolisp to segfault, and it does not print anything to stdout and stderr. If you see a message like segmentation fault when you run it, that message comes from your shell. \$\endgroup\$ – Gilles 'SO- stop being evil' Jul 30 at 22:45
1
\$\begingroup\$

Dirty, 2 bytes, cracks @HighlyRadioactive's answer

0Ḃ

Try it online!

Seems to work with any digit(s) preceding , which is described in the docs as the 'bytes to UTF8' operator.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ The intended solution is: 1 (Yay!) \$\endgroup\$ – null Aug 1 at 6:04
1
\$\begingroup\$

Ruby, cracks Dingus's fourth answer

RUBY_VERSION =~ /\D/
DOT = $&
RUBY_VERSION =~ //
EMPTY_STRING = $&

$_ = $LOADED_FEATURES * EMPTY_STRING
$_ =~ /C/i; LC_C = $&
$_ =~ /H/i; LC_H = $&
$_ =~ /R/i; LC_R = $&
H_DOT_CHR = LC_H + DOT + LC_C + LC_H + LC_R

emit = EMPTY_STRING
h = 112; emit += eval H_DOT_CHR
h = 117; emit += eval H_DOT_CHR
h = 116; emit += eval H_DOT_CHR
h = 99; emit += eval H_DOT_CHR
h = 32; emit += eval H_DOT_CHR
h = 104; emit += eval H_DOT_CHR

h = 99; eval emit
h = 100; eval emit
h = 111; eval emit
h = 112; eval emit
h = 114; eval emit
h = 46; eval emit
h = 96; eval emit
h = 39; eval emit
h = 34; eval emit
h = 63; eval emit
h = 37; eval emit
h = 40; eval emit
h = 91; eval emit
h = 123; eval emit
h = 58; eval emit
h = 60; eval emit

Try it online!

Since we can use eval, the problem is to bootstrap a string that contains some interesting Ruby code. Since we have concatenation, this reduces to looking for individual characters. I went for h.chr, which will then let us construct arbitrary characters with h = NNN; s = eval "h.chr". (h could be any character that is permitted and that we manage to stuff into the string.) Once we have that, we build the string "putc h", and use that to print any character given by its numeric code.

Like before, I tried to extract characters from strings with regular expression matching. And like before, this divides into two subproblems: how to match an individual character, and finding or constructing a string that contains the desired character. Once that's done, we can copy the character from $&. Reviewing regexp features,

Some backslash escapes that match a character in a class are permitted. For example /\D/ matches the first character in a string that isn't a digit. Conveniently, in RUBY_VERSION, that's a ..

Since i is permitted, we can do case-insensitive matching. Since all uppercase letters are permitted, we can obtain a one-character string containing a lowercase letter by matching the corresponding uppercase letter against a string that contains the desired lowercase letter. We do this for c, h and r, all of which are present in $LOADED_FEATURES. That's an array of strings, which we convert to a string by using the join method which is conveniently available as the * operator. This part has me slightly uneasy because it verges on the specifics of an installation rather than on a language feature. However, the necessary characters are found in complex and thread and as far as I understand, these module names have to be present in $LOADED_FEATURES regardless of installation details.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Hats off to you for thwarting me at every attempt. This has been fun. I've posted my code in the cops thread. \$\endgroup\$ – Dingus Aug 1 at 14:12
1
\$\begingroup\$

Dotty, cracks @user's answer

This was kinda hard, but kinda easy and really fun!

object Main; def main(using Array[String]) = print("" + 58.toChar + 92.toChar + 123.toChar);

You can try this on: https://scastie.scala-lang.org/Sthw2Vr7QG26mbMHQuirkg

As of today, it produces the expected output: https://scastie.scala-lang.org/Sthw2Vr7QG26mbMHQuirkg


DISCLAIMER!!!!

This answer is HEAVILY based on https://codegolf.stackexchange.com/a/207833/!

As based on this comment - Print X without X (cop's thread)

@LuisMendo To start as of now full programs are required so return is not possible regardless. I will say that you must indicate if your intended output is to STDERR, although for most languages errors should be somewhat distinct from legitimate output. – Ad Hoc Garf Hunter

The answer was required to be a full program, but the presented answer isn't.

Also, the answer I've taken inspiration from has a mistake on it.

The O.P. of the answer hasn't said their personal opinion since 31st, regarding the validity of the answer.

I believe this answer is different enough to be posted by itself.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Nice job with “using”! Didn’t think of it (I used @main). Also, you don’t need object Main \$\endgroup\$ – user Aug 4 at 0:19
  • 1
    \$\begingroup\$ @user Thank you! I believe that that information should be also part of the cop's answer, where you post your intended solution. This way, more people can learn more and, in case comments are deleted, the information isn't lost. And everybody else is doing the same (I did it too). The using was totally found by chance when reading this: github.com/lampepfl/dotty/commit/… \$\endgroup\$ – Ismael Miguel Aug 4 at 0:20
  • 2
    \$\begingroup\$ Yep, I’ll do that tomorrow when I’m on my PC. Again, nice job. Still, did you have to crack it today, when I was almost safe? :/ \$\endgroup\$ – user Aug 4 at 0:50
  • \$\begingroup\$ @user I mean, it sounded like an interesting challenge. I didn't wanted to pass on it. Specially since part of the answer was already made. (Admitedly, the hardest part for me, honestly.) \$\endgroup\$ – Ismael Miguel Aug 4 at 1:01
  • 1
    \$\begingroup\$ @user I know you meat it as a joke, don't worry. Dotty seems to be interesting and has some cool concepts. Sorry for stealing your almost-safe submission :( \$\endgroup\$ – Ismael Miguel Aug 4 at 7:56
1
\$\begingroup\$

><>, cracks HighlyRadioactive's answer

aa*b+01pv
   +b*aa<;

Try it online!

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

With the letter p is how!

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ See new challenge! \$\endgroup\$ – null Aug 12 at 6:41
1
\$\begingroup\$

><>, cracks HighlyRadioactive's second answer

llllllllllrnnnnnnnnnn'`':::,+:::,+:::,+:::,+:::,+:::,+::l+:::,:pv
> <                                                         ~r~$< 

Exits with an error, but when using the right interpreter (e.g. this), it's not actually output.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ OK, you win. The new challenge is even more inconvenient... \$\endgroup\$ – null Aug 12 at 7:51
1
\$\begingroup\$

><>, cracks HighlyRadioactive's third answer

'.':,:&:-&:&&:&:+:&:&+:&:&+:&:&+:&:&+:&:&+:&:&+:&:&+rnnnnnnnnnn'`'&:&+:&:&+:&:&+:&:&+:&:&+:&:&+'k'&:&+'n'&:&+'k'&:&+'n'&:&+&:pv
> <                                                                                                                          r<

Exits with an error, but when using the right interpreter (e.g. this), it's not actually output.

I knew the register because I stole the feature for Keg.

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ Not the intended solution... a fourth one \$\endgroup\$ – null Aug 12 at 8:07
  • \$\begingroup\$ @HighlyRadioactive okay then. \$\endgroup\$ – Lyxal Aug 12 at 8:08
  • \$\begingroup\$ My intended solutions are much terser than yours... That is, no whitespaces, no repeating code, well golfed. \$\endgroup\$ – null Aug 12 at 8:10
  • 1
    \$\begingroup\$ We're not here for golf though. We're here to crack answers. \$\endgroup\$ – Lyxal Aug 12 at 8:18
  • \$\begingroup\$ Just sayin'. (f chars) \$\endgroup\$ – null Aug 12 at 8:19
1
\$\begingroup\$

PHP <7.0, 34 bytes

I think that <% also works, but I couldn't get that working on an online interpreter, so this is fine. Also, g^X works, but STDERR and STDOUT are mixed on that site. Should also technically be possible with something like <%=~\xc0 for 5 bytes.

<script language="php">echo"\x3f";

Try it online!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

Keg, cracks Lyxal's answer

aA%,aA%,KA%,aA%,nA%,aA%,lA%,aA%,oA%,aA%,yA%,aA%,7,aA%,bA%,aA%,Àa%,aA%,673**,aA%,é85**,aA%,¾b%,aA%,fA%,KA%,aA%,aA%,KA%,aA%,nA%,aA%,lA%,aA%,oA%,aA%,yA%,aA%,7,aA%,bA%,aA%,Àa%,aA%,673**,aA%,é85**,aA%,¾b%,aA%,fA%,KA%,

Ungolfed to avoid what appears to be a bug in Keg. I can't remember if this is exactly what I had in mind a month ago as I can't find the file and never bothered to generate a TIO link in my history, but I reckon it's pretty close.

Try it online

Explanation:

While taking away + and - will make it a little harder to generate numbers, % is still a powerful tool. Unsurprisingly, it's a modulo operator, and by moduloing, say, 65 and 97 (characters A and a, respectively), we can get 32, corresponding to space. It's just subtraction with more steps! We mostly just abuse this to get the characters we need, occasionally switching our base to something like a. This won't work for characters greater than 125 (I mean, it could, but I don't want to look up UTF-8 codes), however, and we need two of these: ~ and . For ~ we just multiply 6, 7, and 3 to get 126. has a prime factorization of 2^3 * 5 * 233, so we use é (char code 233), 8, and 5 and multiply through.

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

PHP 7, 26 bytes, cracks thelmuxkriovar's answer

<?php echo~..............;

Try it online!

This solution contains unprintables so the link is to xxd output which is reversed. Actual bytes are:

<?php echo~\x99\x8a\x91\x8b\x96\x92\xd7\xd6\x84\x82\xa0\xc2\xd0\xa3;

As noted by @thelmuxkriovar this would not work on PHP 8 without quotes.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I love this solution, this is brilliant! you should edit your answer to show the hex code for the characters, however as I couldn't tell what you were trying to do until I clicked the link (fun fact, this won't work in php 8 because they changed undefined constant to an error rather than a warning) \$\endgroup\$ – thelmuxkriovar Aug 19 at 8:41
  • 1
    \$\begingroup\$ @thelmuxkriovar Glad you liked it! I'll add the xxd data into the post too, good shout. If this isn't the intended crack, please feel free to add another banning ~ too! \$\endgroup\$ – Dom Hastings Aug 19 at 8:44
  • \$\begingroup\$ done :) added ~ to the banning, good luck :) \$\endgroup\$ – thelmuxkriovar Aug 19 at 8:52
0
\$\begingroup\$

><>, cracks HighlyRadioactive's fifth answer

'u':-'u':,:'u':,+:'u':,+:'u':,+:'u':,+:'u':,+:'u':,+:'u':,+:'u':,+rnnnnnnnnnn'`''u':,+:'u':,+:'u':,+:'u':,+:'u':,+:'u':,+'%''u':,+'k''u':,+'n''u':,+'h''u':,+'n''u':,+'u':,:pv
> <                                                                                                                                                                         r<

Exits with an error, but when using the right interpreter (e.g. this), it's not actually output.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Right, that's the intended answer. Round 6. (It lasted a whole 7 minutes!) \$\endgroup\$ – null Aug 12 at 8:34
  • \$\begingroup\$ @HighlyRadioactive round 6 will be my last for today. I'll do more tomorrow after that. \$\endgroup\$ – Lyxal Aug 12 at 8:35
  • \$\begingroup\$ I will probably be out of solutions after round 6... This one was the intended solution for round 2 by the way. I was going to use l for round 3... \$\endgroup\$ – null Aug 12 at 8:36
0
\$\begingroup\$

><>, cracks HighlyRadioactive's seventh answer (yes, seventh)

00=n00=00=+n00=00=00=++n00=00=00=00=+++n00=00=00=00=00=++++n00=00=00=00=00=00=+++++n00=00=00=00=00=00=00=++++++n00=00=00=00=00=00=00=00=+++++++n00=00=00=00=00=00=00=00=00=++++++++n00=:+:+:+:+:+::++::,+:00=+:00=+:00=+:00=+:00=+00=:+:+:+:+:+00=:+:++00=:++00=00=00=00=00=++++00=00=+*:*00=:+:+:++:00=00=00=+++:00=00=00=++00=00=+*-00=:+:+:+:+:+00=+00=+00=+00=+00=+00=+00=+00=:+:+:+:+:+00=00=++00=:+:+:+:+:+::++00=00=+::**+00=00=00=00=00=00=00=+++++++00=00=pv
> <                                                                                                                                                                                                                                                                                                                                                                                                                                                                r<

Try it online!

Way easier than last time.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Yep. Let's move on. \$\endgroup\$ – null Aug 13 at 3:52
0
\$\begingroup\$

><>, cracks HighlyRadioactive's eigth answer

:n::+n:::++n::::+++n:::::++++n::::::+++++n:::::::++++++n::::::::+++++++n:::::::::++++++++n:+:+:+:+:+::++::,+:::,+:::,+:::,+:::,+:::,+:::,+::,:+:+:+:+:+::,:::::++++++::,::::++++::,:+*:*::,:::::::++++++++:::,::+++:::,:::::+++++-::,:+:+:+:+:+::,::,::,::,::,::,::,+++++++::,:+:+:+:+:+::,::,++::,:+:+:+:+:+::,:+:+:++:::,+:::,:+:+:+:+::,:+:+++::,:+:+:+::,+::,+::,:+:+:+::,:++:::,:::::+++++*::,:++::-:p::,:+:+::,+::,:+*::*+::,+::,::-p::,::,::,::,::,++++:+::,::,::,::,::,::,+++++*::,:+::-pr>

Try it online!

Requires this interpreter, or, this one like so:

enter image description here

| improve this answer | |
\$\endgroup\$
  • 1
    \$\begingroup\$ For ease of use I ask that you assume there are no command line flags in cases where command line flags are not mentioned. -- OP \$\endgroup\$ – null Aug 13 at 4:45
  • \$\begingroup\$ @HighlyRadioactive asking doesn't equate to solid rules. \$\endgroup\$ – Lyxal Aug 13 at 4:46
  • \$\begingroup\$ Command line flags count as different languages -- also OP \$\endgroup\$ – Dingus Aug 13 at 4:47
  • 1
    \$\begingroup\$ @Dingus which indicates this answer is not written in ><> and is thus invalid \$\endgroup\$ – null Aug 13 at 4:48
  • 2
    \$\begingroup\$ Then that one's not acceptable too \$\endgroup\$ – null Aug 13 at 4:57
1 2
3

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.