20
\$\begingroup\$

Robbers Thread
Cops, your task is to chose a program that prints a string (you can choose). Although, if you change 1 character in your code, it should print another string.

But there's a twist: You should make your code hard to read, so that the robbers can't find your "changeable" character.

The winner cop is the user, with the shortest answer that wasn't cracked for a week.
If your submission wasn't cracked for a week, please reveal your character.

Cops, please include the output that should be printed if that specific character is changed in your code.

I will declare the winner cop and robber a week after this challenge is posted.

Example submission (very easy to understand)

# [Vyxal](https://github.com/Vyxal/Vyxal), 8 bytes, prints a and b

1[`a`|`b

[Try it Online!](https://lyxal.pythonanywhere.com?flags=&code=1%5B%60a%60%7C%60b&inputs=&header=&footer=)
\$\endgroup\$
17
  • 1
    \$\begingroup\$ @Shaggy It should output the string that the cop must have referenced in their post. Editing it. \$\endgroup\$
    – mathcat
    Jul 15, 2021 at 10:32
  • 5
    \$\begingroup\$ But all answers can be trivially brute forced, using the exact same algorithm... how much time did you spend thinking before posting this? Did you post this to the sandbox? \$\endgroup\$ Jul 15, 2021 at 11:28
  • 4
    \$\begingroup\$ @thedefault. in a Turing-complete language, this provably cannot be brute-forced in the general case. Just write a program that does some complicated looping and you'll never brute-force it \$\endgroup\$
    – pxeger
    Jul 15, 2021 at 14:11
  • 1
    \$\begingroup\$ This seems like a very boring CnR, any answer will either be trivially brute forceable or take advantage of some weird unicode + halting problem thing that makes it very tedious and not really easily doable by a human anyway. \$\endgroup\$ Jul 15, 2021 at 21:51
  • 5
    \$\begingroup\$ @pxeger Actually, if you use dovetailing you can always find the solution in finite time provided that one exists. Just run all the programs concurrently. The correct solution will eventually halt, and when it does you can stop execution. \$\endgroup\$
    – Wheat Wizard
    Jul 17, 2021 at 13:42

49 Answers 49

1
2
2
\$\begingroup\$

JavaScript (Node.js), 155 bytes, Cracked by hyper-neutrino

z=247275939563830539741033018025n
k=''
e='Hello, world'
while(z) k+=String.fromCharCode(Number(z%128n)),z/=128n;
console.log(eval([...k].reverse().join``))

Try it online!

The output should be [Function: bound consoleCall].

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

Vyxal s, 13 bytes, Cracked by Aaron Miller

khǍ⇩k•kFk¹↔sU

Try it Online!

Intended text: bcfgjkmnpqstvxz.

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

Japt, 10 bytes, cracked by dingledooper

"1,2"k@X+2

Try it online!

The intended output is 3.4. I have no idea how hard this is to crack, since I barely know any Japt, but hopefully it's not too easy.

\$\endgroup\$
5
  • \$\begingroup\$ I shall be leaving this one for others to attempt :) \$\endgroup\$
    – Shaggy
    Jul 17, 2021 at 19:39
  • \$\begingroup\$ @Shaggy Ah, so it is easy? :P \$\endgroup\$
    – user
    Jul 17, 2021 at 19:39
  • 1
    \$\begingroup\$ as with my 2nd solution, when you know how ;) I think most people will figure out what needs to be done quite easily, but less so how to do it. (Sidenote: you could actually golf 2 bytes off this, but I shan't say what they are yet for fear of helping anyone solve it) \$\endgroup\$
    – Shaggy
    Jul 17, 2021 at 19:42
  • 1
    \$\begingroup\$ Even if it weren't easy, though, I would have left it for others to attempt. \$\endgroup\$
    – Shaggy
    Jul 17, 2021 at 19:46
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$ Jul 18, 2021 at 2:24
2
\$\begingroup\$

R, 77 bytes, cracked by tsh

PO=0
TA=TO =min(0 * 0 * 0, FALSE, 0 * 0 * 0)
if(TA|TO&TA&TO)PO=18
LETTERS[PO]

Try it online!

As usual, the string to output is "R".


A previous version of this challenge allowed an unintended crack, found by Dominic van Essen:

R, 71 bytes

PO=0
TA=TO =min(0 * 0 * 0, FALSE, 0 * 0 * 0)
if(TA|TO)PO=18
LETTERS[PO]

Try it online!

\$\endgroup\$
8
  • \$\begingroup\$ Cracked!... \$\endgroup\$ Jul 18, 2021 at 17:40
  • \$\begingroup\$ Sorry... I've been trying to think-up my own challenges, so I've got a head full of 'tricks' ready to test... \$\endgroup\$ Jul 18, 2021 at 17:42
  • 1
    \$\begingroup\$ @DominicvanEssen Nice find! That's not the intended crack, so I've edited in a variation which is immune to your crack. (Doing this rather than posting a new challenge, to avoid completely overwhelming this thread with R answers!) \$\endgroup\$ Jul 18, 2021 at 21:54
  • 1
    \$\begingroup\$ Is this work?, another intended crack? \$\endgroup\$
    – tsh
    Jul 19, 2021 at 2:00
  • 1
    \$\begingroup\$ @DominicvanEssen I won't post it, as I might be able to recycle the idea into a vastly different challenge. :-) Let me know if/when you find it! \$\endgroup\$ Jul 19, 2021 at 8:49
2
\$\begingroup\$

><>, 536 bytes, Cracked by ovs

\\ /   \  /  9    \
/\     /  /\  /   \\
    / 1/  \       \\\
\\ //  \  \\  /    \\\
 \\  /\ / \\\/ \   \\\\
 ///  \\   \ \//   // \\
/ /\  \\\ \/ \\ \  \\/ /
\\ / \  \\     /\\ // /
//  /     \\\   \\ \ \  \
\\\  /\\/// \ \\// /  \ +
///\ /\/\/ //   /    /
\\/\\/\/\/ / /// / /3 / n\
// \\     /         \ / /
  \ \/\/\/ / // // \/ /  /
\\  //\/\/ / / /  / ;
   \//\/\\ /\/\ /     /
 \  \    \//\ /    \/
 /       //  \ ///
/\\/\/ /\///\\ //
  \/\/
  //\\//\/     \\
 \\  \/    /\/ /\\
\ \  \/  \\  /  //
  \  \/  \/
     \     /\/ \/

Try it online!

A literal maze of mirrors.

My intended solution was:


\\ /   \  /  9    \
/\     /  /\  /   \\
    / 1/  \       \\\
\\ //  \  \\  /    \\\
 \\  /\ / \\\/ \   \\\\
 ///  \\   \ \//   // \\
/ /\  \\\ \/ \\ \  \\/ /
\\ / \  \\     /\\ // /
//  /     \\\   \\ \ \  \
\\\  /\\/// \ \\// /  \ +
///\ /\/\/ //   /    /
\\/\\/\/\/ / /// / /3 / n\
// \\     /         \ / /
  \ \/\/\/ / // // \/ /  /
\\  //\/\/ / / /  / ;
   \//\/\\ /\/\ /     /
 \  \    \//\ /    \/
 /       //  \ ///
/\\/\/ /\///\\ //
  \/\X
  //\\//\/     \\
 \\  \/    /\/ /\\
\ \  \/  \\  /  //
  \  \/  \/
     \     /\/ \/
where the X is a \, and originally was a /.

Execution paths:

enter image description here

I'm not sure if this makes it more understandable or more confusing.

Red is path before the split, yellow is original, orange is correct path.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked \$\endgroup\$
    – ovs
    Jul 26, 2021 at 10:05
2
\$\begingroup\$

Julia 1.x, 53 bytes, Cracked by Robin Ryder

show(sum(count.(==('1'),bitstring.(Int16[9973%36]))))

Try it online!

should output 5

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

Vyxal, 14 bytes, Cracked by Aaron Miller

‛ø»:K:Ẋf∑$βS2Ẏ

Try it Online!

Should output 14.

My intended solution was:

»ø»:K:Ẋf∑$βS2Ẏ

I'm quite surprised that changing the word worked, my intention was changing it to a number, where the output would be 1412 before slicing.

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

JavaScript (REPL), 17 bytes

a=!![],a++,a+=![]

Edit : Actually output "2", should output 3 when the good char is modified

(not sure if the console.log was required or not...)

https://jsconsole.com/

\$\endgroup\$
4
  • \$\begingroup\$ A cop submission to this challenge must include an intended output string the robber should get. \$\endgroup\$
    – Bubbler
    Nov 11, 2021 at 0:41
  • \$\begingroup\$ I've added that ! :) \$\endgroup\$
    – Dnb
    Nov 11, 2021 at 0:47
  • \$\begingroup\$ Welcome to Code Golf! This is a pretty tough cop, I've been trying for a little while to crack it. I don't think you need the console.log, although the question's a little unclear. \$\endgroup\$ Nov 11, 2021 at 0:58
  • \$\begingroup\$ Cracked \$\endgroup\$
    – emanresu A
    Nov 11, 2021 at 4:10
2
\$\begingroup\$

PHP 7.4.2 - 23 bytes

echo md5("leetspeak!");

Let's go for another try ! :)

This one should output

20bff2eab610b29d183a363727b9bfb5

if correctly modified

https://wtools.io/php-sandbox

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

Python 3, 44 bytes, cracked by Dlosc

a=6
b=++a++a++++a++a
a=5*5/5**2
print(b*a-b)

Try it online!

Cracked code by Dlosc:

Python 3, 44 bytes

a=6
b=++a++a++++a++a
a=5*5/5**2
print(b*1-b)

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – DLosc
    Dec 14, 2021 at 23:33
  • \$\begingroup\$ @DLosc Nice, also intended. \$\endgroup\$
    – Alan Bagel
    Dec 15, 2021 at 0:09
2
\$\begingroup\$

IPython, 9 bytes

print(1)#

Should print nothing. I rate this easy and hard.

\$\endgroup\$
2
  • 2
    \$\begingroup\$ I don't know what makes IPython different from normal Python, and I'm not sure where I can test this, but would #rint(1)# be a valid crack? \$\endgroup\$ Dec 17, 2021 at 14:07
  • \$\begingroup\$ @AaroneousMiller Uh yeah, I guess. Not intended, though. \$\endgroup\$
    – Alan Bagel
    Dec 17, 2021 at 14:09
2
\$\begingroup\$

APOL, 70 bytes (Easy)

ƒ(56 ¿(%(I(I(∈ )) 4) ¿(F :(33:3():33::()) ¿(F 2  ¿(≐(∈) 2 3))))((X)) )

The cracked output is:

[None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2, None, 2, 2, 2]
\$\endgroup\$
5
  • \$\begingroup\$ Could you link to an interpreter we can use to test our cracks? \$\endgroup\$ Dec 17, 2021 at 14:05
  • \$\begingroup\$ @AaroneousMiller Sure, here's one on repl.it replit.com/@GingerIndustries/APOL \$\endgroup\$
    – Ginger
    Dec 17, 2021 at 14:05
  • \$\begingroup\$ @AaroneousMiller Fixed the help (I hope) \$\endgroup\$
    – Ginger
    Dec 17, 2021 at 14:06
  • \$\begingroup\$ lol thx, I'll check it out \$\endgroup\$ Dec 17, 2021 at 14:06
  • \$\begingroup\$ cracked \$\endgroup\$ Dec 17, 2021 at 14:47
2
\$\begingroup\$

Python 3, 35 bytes

a=-123**6;b=-456**6;print(a*b|b//a)

Try it online!

Might be a bit simple, but I had fun writing it. Output should be 31132910605162826264952179236

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

Rattle, 8 bytes, cracked by Aaron Miller

<[c]9I^p

Try it Online!

This code outputs the string 10. With one character changed, it should output the string 100.

Explanation of crack:

"<" decrements the pointer, which wraps around to slot 99. "[c]@" concatenates the value at this memory slot (0) to the value on top of the stack. This results in a string of 100 zeroes. "I^" takes the length of this string, giving 100. "p" converts 100 to a string and prints it.

\$\endgroup\$
3
  • \$\begingroup\$ cracked \$\endgroup\$ Jul 16, 2021 at 14:20
  • \$\begingroup\$ @AaronMiller nice! Was that brute force, or did you use the documentation? \$\endgroup\$
    – Daniel H.
    Jul 16, 2021 at 15:04
  • \$\begingroup\$ A bit of both. I looked at the documentation to find some commands I thought might do it, and I also used it to find some commands that had to stay the same, then brute forced from there since I don't quite get the syntax yet. I'd love to learn the language once it's finished, though! \$\endgroup\$ Jul 16, 2021 at 15:17
1
\$\begingroup\$

Jelly, 254 bytes (cracked by the default.)

“5gỊƑ!ṆḥḌ³`⁻Ɓc?Ạ°þạḅI§Ɠ¦mṪ9ʂ:Nȯx1®Ḟ ƭḣTsÄẉṭ7|ẏẋzⱮɦḲ⁵.ṗbÐɱ8Ñ3"Øȧ¡Ė÷ʠ\¬ṇƥṀœṙRṅẈɓẒ#Ẏỵ⁼Ȧ©MỴƤ⁷ẹ⁴ż;OṃċẊnFḶ¤ȤḟỤẇçİ/ƒjƬhƙA2PẸtX¿ṢḢṡyiṂCd)ÆṣĠʋŒ-ė~YZ⁾ĿṘ²ŀ'ṄLȷU£BSƲɼṛñ½ȥÞ6pḂæ×ẆɠG4ịı$EƊ¹¥ḃɗ}DK]u*ġṚk⁹ɲḊµṾW+,ȧwß⁺⁸0ọv(<Ɲṁḍl=Q+ð@Çø[Żṫoera&Ọ¢Vḷ¶Ṗ€ƈḋ{⁶ƇĊqḄHḳJ⁽Ȯ%>^ḤṠfƘṬ‘Œ¿

Try It Online!

The output should be:

690699296939718117350621606422816362267173158421165414491974510998788124940831200375657067696758989277663531427881606883007285313136136830578271394860909143130892610035752665368298072483371326623846259135567658705756844088966332891398225673436164647788793408591250973256547482034045337013090045826070073469995435050529779518827764039871801756995315995194485429761879045854501788974715014302780100588547060896111645050429507146677667643527115067082983636640551198432670539417621925424456729027

I imagine this shouldn't be difficult, even just to brute-force with Jelly's SBCS like someone in chat pointed out. I am working on a solution that will be slow to verify so that it is not brute-forceable (even though I don't think any of the other solutions have been brute-forced, I want to try this just for proof of concept), and using permutations or powersets is probably a good approach.


The intended intended solution was to reverse the permutation index. However, for whatever reason, generating a random permutation of 1..250 and indexing into the codepage gave me a duplicate, so I'm not sure if I copy-pasted the wrong string or I'm just really fucking stupid.

Either way, brute-force crack would be the only valid solution since I messed up the format.

\$\endgroup\$
3
  • \$\begingroup\$ Cracked (by brute force). \$\endgroup\$ Jul 16, 2021 at 16:51
  • \$\begingroup\$ I haven't used the permutation for index built-in because your string has two repetitions: + appears both on positions 191 and 209, and ȧ appears both at 61 and 193 (so it is impossible for the correct input to be a permutation, and thus the 'find a permutation' built-in can't be helpful). In practice, it fails as expected (it returns an input that differs at 2 positions instead of 1) \$\endgroup\$ Jul 16, 2021 at 17:10
  • \$\begingroup\$ @thedefault. wait... what? ... I literally had jelly generate me a random permutation of 1..250... oh well, good crack then \$\endgroup\$
    – hyper-neutrino
    Jul 16, 2021 at 17:13
1
\$\begingroup\$

R, 48 bytes, cracked by pxeger

x=z=6
y=0
while(x+y-1>y){x=x-1;z=z+1}
LETTERS[z]

Try it online!

Once again, the string to output is "R".

I think and hope the solution is unique, but I might have missed something. Edit: indeed I had missed something...

\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – pxeger
    Jul 16, 2021 at 18:26
  • \$\begingroup\$ @pxeger Well done! That's not what I had intended, but I was scared I might have missed something like that. Back to the drawing board... \$\endgroup\$ Jul 16, 2021 at 18:46
1
\$\begingroup\$

Brainf***, 51 bytes - cracked by dingledooper

++++++++++[>+++++++++++<-]>++.-------.+++++.++++++.

Try it Online!

Right now it outputs pint. Can you make it output ohms?

\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$ Jul 21, 2021 at 3:59
  • \$\begingroup\$ Wow, not even ten minutes! Good job! \$\endgroup\$ Jul 21, 2021 at 4:02
1
\$\begingroup\$

J, 7 bytes, cracked by Adám

13024e0

Try it online!

Outputs 13024. Cracked solution should output 69420 instead.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – Adám
    Jul 21, 2021 at 7:39
1
\$\begingroup\$

Labyrinth, 7 bytes, cracked by m90

999
!!@

Try it online!

Outputs 99. Change it to 9900.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – m90
    Jul 21, 2021 at 10:44
1
2

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.