76
14
Note: This challenge is now closed. Any future cops' submission will not be considered for the accepted answer. This is to ensure that no one can post a very simple regex in the future that only remains uncracked because no one is interested in the challenge any more.
The Cops' Challenge
You are to write a short, obfuscated regex, satisfying the following spec:
You may choose any flavour that is freely testable online. There's a good list of online testers over on StackOverflow. In particular, Regex101 should be good to get you started, as it supports PCRE, ECMAScript and Python flavours. You can increase the timeout limit by clicking on the wrench in the top right corner if necessary. Please include the tester you choose in your answer.
If no suitable tester is available for your flavour of choice, you may also use an online interpreter like ideone and write a little script in the host language which people can use to test your submission.
- You may use any feature of that flavour, which does not directly invoke the host language (like Perl's code evaluation features).
- Likewise, you may use any modifiers (if your flavour has them), unless they result in code evaluation.
- Your regex must accept at least one string S and reject at least one string T, each of which is at least 16 and not more than 256 characters in length, in a reasonable amount of time (not significantly longer than a minute). S and T may contain Unicode characters that aren't ASCII, as long as there's a way to enter them into the online tester. Any such pair of strings will be a key to your submission.
- Your regex may take arbitrarily long on any other input.
The core of the challenge is to craft a regex whose key is hard to find. That is, it should either be hard to tell which string it doesn't match or which string it matches (or potentially even both if the regex takes days to finish on all but the key's strings).
The Robbers' Challenge
All users, including those who have submitted their own regex(es), are encouraged to "crack" other submissions. A submission is cracked when one of its keys is posted in the associated comments section.
Important: Make sure that both strings you post are between 16 and 256 characters inclusive, even if almost any string could be used be used for one part of the key.
If a submission persists for 72 hours without being modified or cracked, the author may reveal a valid key by editing it into a spoiler-tag in his answer. This will make his answer "safe", i.e. it can no longer be cracked.
Only one cracking attempt per submission per user is permitted. For example, if I submit to user X: "Your key is 0123456789abcdef
/fedcba9876543210
." and I'm wrong, user X will disclaim my guess as incorrect and I will no longer be able to submit additional guesses for that submission, but I can still crack other submissions (and others can still crack that submission).
Cracked submissions are eliminated from contention (provided they are not "safe"). They should not be edited or deleted. If an author wishes to submit a new regex, (s)he should do so in a separate answer.
Do not crack your own submission!
Note: For long strings in the comments without spaces, SE inserts manual line breaks in the form of two Unicode characters. So if you post a key in backticks which is so long that it line-wraps between non-space characters, it won't be possible to copy the key straight back out into a regex tester. In this case, please provide a permalink to the relevant regex tester with the cop's regex and your key - most testers include this feature.
Scoring
A cop's score will be the size of their regex in bytes (pattern plus modifiers, potential delimiters are not counted), provided that it hasn't been cracked. The lowest score of a "safe" submission will win.
A robber's score will be the number of submissions they cracked. In the event of a tie, the total byte size of submissions they cracked will be used a tie-breaker. Here, highest byte count wins.
As stated above, any cop may participate as a robber and vice-versa.
I will maintain separate leaderboards for the two parts of the challenge.
Leaderboards
Last update: 19/10/2014, 20:33 UTC
Cops:
Submissions in italics are not yet safe.
- nneonneo, 841 bytes
- Wumpus Q. Wumbley, 10,602 bytes
- Sp3000, 52,506 bytes
- user23013, 53,884 bytes
- nneonneo, 656,813 bytes
Robbers:
- user23013, Cracked: 11, Total Size: 733 + 30 + 2,447 + 71 + 109 + 121 + 97 + 60 + 141 + 200,127 + 7,563 = 211,499 bytes
- nneonneo, Cracked: 10, Total Size: 4,842 + 12,371 + 150 + 3,571 + 96 + 168 + 395 + 1,043 + 458 + 17,372 = 40,466 bytes
- Wumpus Q. Wumbley, Cracked: 6, Total Size: 22 + 24 + 158 + 32 + 145,245 + 145,475 = 290,956 bytes
- Dennis, Cracked: 2, Total Size: 70 + 73 = 143 bytes
- harius, Cracked: 1, Total Size: 9,998 bytes
- g.rocket, Cracked: 1, Total Size: 721 bytes
- stokastic, Cracked: 1, Total Size: 211 bytes
- Sp3000, Cracked: 1, Total Size: 133 bytes
- TwiNight, Cracked: 1, Total Size: 39 bytes
@MartinBüttner: I think it will have to be standard for cops & robbers challenges to have an expiry date. Challenges only stay interesting for so long. (For the record, this challenge is probably still my personal favorite, but I may be biased in that opinion :) – nneonneo – 2014-12-16T00:15:09.653
6I wonder how many lines of code we've collectively written constructing these puzzles and attempting to solve them... and whether it would be worthwhile to collect it all and stick it on github when we're done. Everybody could contribute whatever they've got (encoders, decoders, solvers both successful and unsuccessful), as-is, uncommented and hackish though they may be. With a README if you feel like it. It would be like our conference proceedings. – None – 2014-10-25T00:22:01.400
While there aren't any new answers being posted anymore, it may be worth "closing" the question at some point. Otherwise, it may be possible for someone to answer when the interest has died down, and stand uncontested for a longer period. – nneonneo – 2014-10-27T03:51:35.167
@nneonneo Hm, I don't usually like to close my challenges, but in this case it may be a good idea. I even think the last 3 entries already benefited from getting less attention. I'll set a deadline for Friday. – Martin Ender – 2014-10-27T10:18:12.950