The robber's thread is here

The cops task is to write a function or program that, when given an input of itself, outputs a finite deterministic string. If the program is given a different input, it should return a different output.

Rules:

  • Submissions consist of
    • Language name
      • If any flags are used, they should be revealed.
    • Byte count of program
    • Byte count of output
    • Output
      • If it is particularly long, please provide a pastebin or something similar
      • If it contains unprintables, please provide a hexdump.
      • Trailing newlines and whitespace should be included in the output
    • Where the input is coming from (STDIN, command line, etc.)
  • If applicable, you may assume that the byte representing EOF is not present in the input, unless you use that byte in your program.
  • If your program is cracked, add a link to the corresponding answer in the robber's thread in your title.
  • Your program is not safe until a week has passed and you mark it so.
  • I disapprove of techniques like seeding random with the input or cryptographic hash functions. I can't stop them, but I will not be accepting a solution that utilises either of these. Also note that some of these techniques might have collisions, where a different string produces the same output.
  • Your goal is to have the shortest output. The shortest safe solution posted within three weeks of posting this question wins!

The robber's task is to find a program of size equal to or less than the original, which also obeys the above rules.

If a robber cracks your program with a different solution than intended, then you have the opportunity to 'uncrack' it by proving that the robber's solution is incorrect. You can do this by finding an input to the robber's program that will produce the same output.

Example Submission:

brainfuck, 10 bytes, Score: 10

]<.[<],>[,

This solution is ,[>,]<[.<] which simply reverses the input

Good luck!

  • "If the program is given a different input, it should return a different output." Does this means the program should never output the same thing for other inputs? Or does this means the program should not constantly output something regardless the input? (EXIST an input not equals to itself, vs., FORALL inputs not equal to itself, return a different output.) – tsh Nov 6 at 7:58
  • @tsh Only the input of itself must have a unique output. For example, a valid submission could be a self-identifying program, which outputs 1 for itself and 0 otherwise – Jo King Nov 6 at 8:18
  • @JoKing So your example Python 3 submission is invalid? Because it obvoiusly also outputs 1021111143210532105110321051101121171164041581121141051101164011111410040105414410111010061393941 for some other strings. – Lynn Nov 7 at 13:00
  • @lynn You're right. I've removed that example – Jo King Nov 7 at 13:30
  • Using cryptographic hash would be hard to work anyway, because of hash collisions. – user202729 Nov 7 at 15:54

11 Answers 11

Node.js v10.9.0, 40 bytes, Score: 40, Cracked

Input

This is a function taking exactly one parameter.

Output

&`nij.9=j.,)r31n=+(=ooj`[o.o.)1.s](>=6>t
  • I can only rearrange into o=>[...j=o,].sort(n=>(j+=113)&69).join`` , but j can't go to integer – l4m2 Nov 6 at 16:21
  • Cracked. That was quite fun :-) – ETHproductions Nov 7 at 2:56

7, 31 characters, score 30

A 7 program is normally just a number, but it can contain whitespace, splitting it into multiple numbers. This submission therefore consists of two numbers (which are implicitly concatenated by the 7 interpreter), and the program likewise takes two numbers as input, via standard input. (The "31 characters" in the header is the total length of the two numbers, plus one separating whitespace character; the digits that make up the numbers are interpreted as octal when used as a program, but decimal when used as an input, and it's the digits that are the same in the two cases, not the actual numbers. Note that it's irrelevant either when treated as a program, or when treated as an input, whether you separate them with a space or a newline; I hope that doesn't invalidate the submission.)

The expected output is the following number (expressed here in decimal, as that's the output format that the 7 interpreter uses):

238363505302130098723162537059

Note that the 7 interpreter linked from the Esolang wiki internally stores numbers in unary, meaning you're unlikely to have enough memory to actually run the program on itself to see what it does. I verified the program via working out its behaviour manually, and testing it on small inputs to verify that it did what I expected it to do. An alternative approach would be to write an interpreter that uses a more efficient method of storing numbers.

Avoiding cracks here was something of a pain, but I'm finally now satisfied that no two numbers other than those in the program itself are capable of producing 238363505302130098723162537059 as output.

05AB1E, 35 bytes, Score: 7

Input:
From stdin

Output:
QÕ Ƿe

Jelly, 14 bytes, Score: 21

Both the program and output size are counted using Jelly codepage.

Input

First command-line argument.

Output

-§ḋẇ"*YdĖDƘ>Ẉed€Ç+æạɦ
  • Because converting from/to Jelly codepage is hard, it would be useful to have a verifier (that takes a program, convert it from UTF8 to Jelly, feed it with itself, convert from Jelly to UTF8, and check if it's equal to the expected output) – user202729 Nov 7 at 16:02
  • @user202729 this Jelly program, v⁼, will yield 1 if the input evaluated as Jelly code with an input of the input is equal to the input and will either yield 0 or error (if the input is an invalid Jelly code) if not. – Jonathan Allan Nov 9 at 20:10

Cubix, 18 bytes, Score 18

This should be quite easy to crack.

Input from stdin

Output

$`*2aJPJ#74(o);89

Edit: I should mention that this expects the source in it's shortened form ... and now I've noticed that there is a missing byte (unprintable) from the result that I broke when I posted. Should copy out now. The hex values are 24 60 2a 13 32 61 4a 50 4a 23 37 34 28 6f 29 3b 38 39

A Pear Tree, 46 bytes of ASCII, score 0

Input is taken from standard input. The expected output (on standard output) is an empty string (i.e. when the program is given itself as argument, no output should be printed).

In other words, the challenge here is to write an A Pear Tree program that does not output anything on standard output when given itself on standard input, and which does output something on standard output when given something other than itself on standard input, using no more than 46 bytes. (I've managed to do this while holding the program to printable ASCII, too, despite A Pear Tree frequently using non-ASCII and unprintable characters.) This is effectively the task of writing a self-identifying program, with a specific output format (i.e. null string when self-identification succeeds); however, A Pear Tree has at least two twists that make the task somewhat more difficult than it looks when done in this specific language (which is why I chose it for my cop submission).

J, 26 bytes, Score: 52

The program is not a REPL, but a full script that accepts stdin and explicitly prints to stdout.

Input

Standard input.

Output

6fc42353c98217ef5a2908a3c63d090aa9a55b2558b61294e06a

No, it's not an encryption method.

GCC 61->61 bytes

70 4F 92 73 08 D4 03 E7 65 DC D6 89 B5 AD BA 90 
97 26 31 10 F6 FA 0A 30 8F 24 69 0A A7 8B 59 9E 
A2 42 D5 67 B8 12 3A 1E 9D 25 80 F9 6B 25 32 C2 
EE 46 3F 8D 7E 0C 73 0F F0 93 C6 68 50

Full program, take input from stdin and output to stdout

  • So, is there a space after last 50? – tsh Nov 8 at 2:43
  • @tsh It's a hex dump – l4m2 Nov 8 at 8:46

Perl 6, 43 bytes, Score: 15, from stdin

49671296789805
  • 2
    Just checking, since your previous answer didn't follow the rules on a unique output for your program as input, can you confirm that this submission does? – Jo King Nov 9 at 3:37
  • Yes, I think so. – donaldh Nov 9 at 8:59

JavaScript Firefox, <10 bytes, Score: 52, from function argument input, Cracked

ZnVuY3Rpb24gYnRvYSgpIHsKICAgIFtuYXRpdmUgY29kZV0KfQ==


btoa

btoa(btoa) encodes the following string:

function btoa() {
    [native code]
}

which gives:

"ZnVuY3Rpb24gYnRvYSgpIHsKICAgIFtuYXRpdmUgY29kZV0KfQ=="

just copied

  • First of all, after doing the obvious, this isn’t actual code? Second, you don’t specify where input comes from. I would post a crack but honestly I’m not sure if this submission is valid. – Quintec Nov 6 at 12:49
  • Cracked – Arnauld Nov 6 at 15:12
  • I don't think it's necessary to include the crack post in this post -- people can just click the link to view the crack. – user202729 Nov 7 at 15:35

 Perl 6, 31 bytes, Score: 39, from stdin - Cracked

Cracked here

().1111111111112222235abcegijkmnorstvy

Crude solution. Might survive.

  • I'm pretty sure that I cracked your solution and I suspect that your program doesn't follow the rule that different inputs should produce different outputs. – nwellnhof Nov 7 at 1:56

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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