4
\$\begingroup\$

The cop's thread is here

The robber's task is to find a program of size equal to or less than the cop's program, which, when given an itself as input, produces the same output as the cop's program.

Additionally, even if a cop's answer is provisionally marked Safe and has been revealed, you can still crack it by finding an input that is not the same as the given source code, but still produces the same output.

Rules:

  • Submissions consist of
    • Language name + flags
    • Username of the cop with a link to the original post
    • The cracked program
  • An explanation would be appreciated
  • Your goal is to crack the most Cop's programs

Some Examples:

brainfuck, xxx's submission

[,[>,]<[.<]]

Try It Online!

This program simply reverses the input

Good luck!

\$\endgroup\$

6 Answers 6

5
\$\begingroup\$

Node.js v10.9.0, Arnauld

o=>[...o].sort(n=>16&(j+=13),j=9).join``

Try it online!

This outputs this particular permutation of itself when using Node's current sorting algorithm:

&`nij.9=j.,)r31n=+(=ooj`[o.o.)1.s](>=6>t

An insightful comment by l4m2 gave me a headstart, but I had to write a brute-forcer to figure out which permutation of digits gives the correct output...

\$\endgroup\$
1
  • \$\begingroup\$ Note. Why the output should be unique: input length = output length, the compare function output (and the permutation) is independent of the array elements, and the permutation is invertible. \$\endgroup\$
    – DELETE_ME
    Nov 15, 2018 at 4:25
4
\$\begingroup\$

JavaScript Firefox, l4m2

btoa

btoa(btoa) encodes the following string (including linefeeds):

function btoa() {
    [native code]
}

which gives:

"ZnVuY3Rpb24gYnRvYSgpIHsKICAgIFtuYXRpdmUgY29kZV0KfQ=="
\$\endgroup\$
3
\$\begingroup\$

Python 3.6+, agtoever

print("".join([f"{ord(c)^170}" for c in input()]))

Since the byte count was 50 and there were 150 digits, I split it into groups of 3, and then guessed that some XOR had been applied to the ASCII representations of the characters so iterated over all possible XORs.

Try it online!

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

Perl 6, donaldh

bag(get.comb).kv.sort.join.say

Try it online!

(This produces the same output for all permutations of the input, for example ().....aabbceggijkmnooorssttvy, but I strongly suspect that this is donaldh's program.)

\$\endgroup\$
1
  • \$\begingroup\$ It's a fair cop. Busted. It really was too crude. \$\endgroup\$
    – donaldh
    Nov 7, 2018 at 11:57
2
\$\begingroup\$

A Pear Tree, ais523

eval(x=q[print"eval(x=q[$x])"ne$_||exit|UPNR])

Try it online!

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

Pepe, u_ndefined

Bit late back to this, but this looks to be simply add the character index to the char value

REEerEEReEeREEEEEeeeree

You can try it here. The permalink forces in breaks, but it should still work.

\$\endgroup\$
3
  • \$\begingroup\$ Link: soaku.github.io/Pepe/#TELS1* - you have to click on the "compressed" link and then copy the page URL \$\endgroup\$
    – RedClover
    Dec 13, 2018 at 10:12
  • \$\begingroup\$ @RedClover Tried that, but it put additional spaces in the code for me, so I left it for copy paste. \$\endgroup\$
    – MickyT
    Dec 16, 2018 at 17:58
  • \$\begingroup\$ That's the expected behavior. I might improve the tool in the future, but I think it's good as it is now. \$\endgroup\$
    – RedClover
    Dec 17, 2018 at 14:31

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.