94
12
This is the cops' thread. The robbers' thread is here.
Your challenge is to make a program that runs forever without halting1, unless it gets a particular input or inputs2. If it receives that input, it must terminate in a finite amount of time3. This is code-golf, so the shortest answer that has not been cracked by a robber within one week of posting wins. After the week has passed, please mark your answer as safe and show the halting input (in a > ! spoiler quote
). If a robber cracks your submission, please mark it as cracked and show the halting input (in a > ! spoiler quote
).
Submissions are preferred be runnable & crackable on TIO. Submissions not runnable or crackable on TIO are allowed, but please include instructions to download / run them.
Please make your input deterministic, and uniform across all runs. See this meta post for details.
Please, don't "implement RSA" or anything mean to the robbers. Use obscure languages and features, not boring encryption and hashing. I can't enforce this with rules, but you can expect torrential downvotes if all you do is sha(input) === "abcd1234"
.
1Assuming that the computer doesn't get shut down, break, get engulfed by the sun, overheat in the universe's heat death, or hit the TIO timeout of 60s.
2The program must halt on at least one input. As long as it loops forever on one input and halts on another, it works.
3This must be < 60 seconds, so that the code can be tested on TIO.
Looking for uncracked submissions?
fetch("https://api.stackexchange.com/2.2/questions/135363/answers?order=desc&sort=activity&site=codegolf&filter=!.Fjs-H6J36vlFcdkRGfButLhYEngU&key=kAc8QIHB*IqJDUFcjEF1KA((&pagesize=100").then(x=>x.json()).then(data=>{var res = data.items.filter(i=>!i.body_markdown.toLowerCase().includes("cracked")).map(x=>{const matched = /^ ?##? ?(?:(?:(?:\[|<a href ?= ?".*?">)([^\]]+)(?:\]|<\/a>)(?:[\(\[][a-z0-9/:\.]+[\]\)])?)|([^, ]+)).*[^\d](\d+) ?\[?(?:(?:byte|block|codel)s?)(?:\](?:\(.+\))?)? ?(?:\(?(?!no[nt][ -]competing)\)?)?/gim.exec(x.body_markdown);if(!matched){return;}return {link: x.link, lang: matched[1] || matched[2], owner: x.owner}}).filter(Boolean).forEach(ans=>{var tr = document.createElement("tr");var add = (lang, link)=>{var td = document.createElement("td");var a = document.createElement("a");a.innerHTML = lang;a.href = link;td.appendChild(a);tr.appendChild(td);};add(ans.lang, ans.link);add(ans.owner.display_name, ans.owner.link);document.querySelector("tbody").appendChild(tr);});});
<html><body><h1>Uncracked Submissions</h1><table><thead><tr><th>Language</th><th>Author</th></tr></thead><tbody></tbody></table></body></html>
What counts as "forever"? For example, if the program builds a growing array, can we assume infinite memory? – Luis Mendo – 2017-07-24T16:08:58.160
1@LuisMendo assuming infinite memory is fine – programmer5000 – 2017-07-24T16:29:42.887
1@programmer5000 Thanks for clarifying. You should incorporate all this into the challenge text. Answerers are not expected to read all comments – Luis Mendo – 2017-07-24T16:48:43.933
6Can we restrict the input to, say, an integer? A robber could pass in some malformed or mistyped input to terminate the program immediately. I'd either have to do lots of careful input validation, or use a language that can catch arbitrary errors. – xnor – 2017-07-24T18:37:04.573
3@xnor I think you're supposed to have to do the input checking. – Stephen – 2017-07-24T18:49:37.840
1@StepHen That works if the malformed input is still able to be parsed by the interpreter. If I enter an illegal string,
R
errors immediately, without even entering the function to crack. I would argue that that doesn't count as actually terminating the function. – JAD – 2017-07-26T05:02:34.053ArnoldC is also out essentially automatically, as any input other than an integer is unsupported by the language and will throw a
java.util.InputMismatchException
– TemporalWolf – 2017-07-26T20:19:14.390