6
\$\begingroup\$

This is the cops' post. The robbers' is here.

You make a program and a regex.

For most inputs, one of the following happens:

  • the regex doesn't match, and the program returns a falsey value
  • the regex doesn't match, and the program returns a truthy value
  • the regex matches, and the program returns a truthy value

But for one (or more) input, the regex matches, but the program returns a falsy value.

You should try to keep this input hidden. Robbers will try to find an input where the regex matches, but the program returns a falsy value.

Post your program and your regex, as well as your language name, byte count of the program, regex flavor, and byte count of the regex.

If a robber finds an input where the regex matches, but the program returns a falsy value, even if it wasn't the intended input your program is considered cracked, and you edit in a link to the robber's crack.

If nobody has cracked your program & regex after a week, then edit in that your submission is safe and is therefore not eligible for cracking. Also edit in the intended input. The shortest (program bytes + regex bytes) non-cracked submission wins.

Example

Let's say your regex is (all of the flavors):

/^[0-9]$/

And your program is (JS):

x=>Boolean(parseInt(x))

Then a valid crack would be 0, because the regex matches 0 but 0 is falsey.

Delimiters don't count in the byte count.

I can't enforce the banning of hash functions with rules, but please don't use SHA/RSA or anything that is unfair to the robbers

\$\endgroup\$
  • 2
    \$\begingroup\$ Are cryptographic hash functions allowed? I can imagine regex (..)+ and program print hash(input)==... \$\endgroup\$ – fireflame241 Aug 29 '17 at 1:21
  • 1
    \$\begingroup\$ @fireflame241 see edits \$\endgroup\$ – programmer5000 Aug 29 '17 at 12:39
3
\$\begingroup\$

Python, cracked

Regex: (?!.)

Program: from operator import not_

This is a little easier than my previous one.

\$\endgroup\$
3
\$\begingroup\$

JavaScript (Cracked)

Regex: ..
Program: a=>[...a].length-1

This is an easy one.


Intended solution


😊

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

Python 3, cracked by ovs

Regex: .

Program: lambda a:len(a.lower()) == 1

This shouldn't be wasn't too hard.

\$\endgroup\$
  • \$\begingroup\$ Cracked \$\endgroup\$ – ovs Aug 29 '17 at 7:03
1
\$\begingroup\$

JavaScript ES6, 12 bytes + 3 bytes

Regex: ...

Code: a=>a+1<a-1+2

\$\endgroup\$
  • 2
    \$\begingroup\$ It is supposed to be hard to produce a false. With your program, almost any 3-digits number (and more inputs) would produce it. \$\endgroup\$ – Uriel Feb 18 '18 at 22:47
0
\$\begingroup\$

Java (OpenJDK 9), 198 bytes, (Cracked)

public static boolean isProgramValid(String n) {
    try{
        Class.forName(n);
    } catch(Exception e){
       return false;
    }
    return true;
}

public static String regex = "^(?is)([a-z]+\\.){4}.*$";

Should be an easy one.

Try it online!

\$\endgroup\$
  • 3
    \$\begingroup\$ Isn't the question tagged as code-golf? Why all these white spaces and boolean instead of int? \$\endgroup\$ – user72349 Aug 29 '17 at 12:25
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$ – PunPun1000 Aug 29 '17 at 12:33
-3
\$\begingroup\$

Pyth

Regex: .*

Program: !qC%.hz^TT"U|(¡

Try it online!

Simple hash function, shouldn't be allowed, but it is. I could've made it much stronger, but I tried to optimize for byte count.

\$\endgroup\$
  • 1
    \$\begingroup\$ Stop suggesting we make things into pop-cons! Pop-cons are almost never good nowadays, and this challenge is much much better as a cops and robbers. The issue is that the OP hasn't yet clarified, which does not mean that it should be a pop-con. \$\endgroup\$ – caird coinheringaahing Aug 29 '17 at 11:50
  • \$\begingroup\$ He has to do one of the two things, otherwise the winner is whoever can create the shortest hash that remains secure. \$\endgroup\$ – Sebastian Aug 29 '17 at 11:58
  • 1
    \$\begingroup\$ I'm not arguing with that, I'm arguing with the Maybe make the challenge a popularity contest instead. That is in no way the correct solution to a problem in a question. Take a look through this and see how many are closed. Pop-con is not a solution to an under specified challenge, it is a separate challenge type. \$\endgroup\$ – caird coinheringaahing Aug 29 '17 at 12:07
  • \$\begingroup\$ Good point, turns out I wasn't aware of what makes a challenge a good popularity contest. Edited my answer. \$\endgroup\$ – Sebastian Aug 29 '17 at 15:23

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.