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
6 Answers 6
-
\$\begingroup\$ Cracked \$\endgroup\$Eli Richardson– Eli Richardson2017年08月29日 09:19:56 +00:00Commented Aug 29, 2017 at 9:19
Python, cracked
Regex: (?!.)
Program: from operator import not_
This is a little easier than my previous one.
JavaScript ES6, 12 bytes + 3 bytes
Regex: ...
Code: a=>a+1<a-1+2
-
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– Uriel2018年02月18日 22:47:59 +00:00Commented Feb 18, 2018 at 22:47
Python 3, cracked by ovs
Regex: .
Program: lambda a:len(a.lower()) == 1
This (削除) shouldn't be (削除ここまで) wasn't too hard.
Pyth
Regex: .*
Program: !qC%.hz^TT"U|(¡
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.
-
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\$2017年08月29日 11:50:46 +00:00Commented Aug 29, 2017 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 Mendez– Sebastian Mendez2017年08月29日 11:58:35 +00:00Commented Aug 29, 2017 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\$2017年08月29日 12:07:34 +00:00Commented Aug 29, 2017 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 Mendez– Sebastian Mendez2017年08月29日 15:23:36 +00:00Commented Aug 29, 2017 at 15:23
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.
-
3\$\begingroup\$ Isn't the question tagged as
code-golf? Why all these white spaces and boolean instead of int? \$\endgroup\$user72349– user723492017年08月29日 12:25:53 +00:00Commented Aug 29, 2017 at 12:25 -
1\$\begingroup\$ Cracked \$\endgroup\$PunPun1000– PunPun10002017年08月29日 12:33:54 +00:00Commented Aug 29, 2017 at 12:33
(..)+and programprint hash(input)==...\$\endgroup\$