A simple "spy versus spy" challenge.
Write a program with the following specifications:
- The program may be written in any language but must not exceed 512 characters (as represented in a code block on this site).
- The program must accept 5 signed 32-bit integers as inputs. It can take the form of a function that accepts 5 arguments, a function that accepts a single 5-element array, or a complete program that reads 5 integers from any standard input.
- The program must output one signed 32-bit integer.
- The program must return 1 if and only if the five inputs, interpreted as a sequence, match a specific arithmetic sequence of the programmer's choosing, called the "key". The function must return 0 for all other inputs.
An arithmetic sequence has the property that each successive element of the sequence is equal to its predecessor plus some fixed constant
25 30 35 40 45 is an arithmetic sequence since each element of the sequence is equal to its predecessor plus 5.
17 10 3 -4 -11 is an arithmetic sequence since each element is equal to its precessor plus -7.
1 2 4 8 16 and
3 9 15 6 12 are not arithmetic sequences.
A key may be any arithmetic sequence of your choosing, with the sole restriction that sequences involving integer overflow are not permitted. That is, the sequence must be strictly increasing, strictly decreasing, or have all elements equal.
As an example, suppose you choose the key
98021 93880 89739 85598 81457. Your program must return 1 if the inputs (in sequence) match these five numbers, and 0 otherwise.
Please note that the means of protecting the key should be of your own novel design. Also, probabilistic solutions that may return false positives with any nonzero probability are not permitted. In particular, please do not use any standard cryptographic hashes, including library functions for standard cryptographic hashes.
The shortest non-cracked submission(s) per character count will be declared the winner(s).
If there's any confusion, please feel free to ask or comment.
All readers, including those who have submitted their own programs, are encouraged to "crack" submissions. A submission is cracked when its key is posted in the associated comments section. If a submission persists for 72 hours without being modified or cracked, it is considered "safe" and any subsequent success in cracking it will be ignored for sake of the contest.
See "Disclaimer" below for details on the updated cracking score policy.
Cracked submissions are eliminated from contention (provided they are not "safe"). They should not be edited. If a reader wishes to submit a new program, (s)he should do so in a separate answer.
The cracker(s) with the highest score(s) will be declared the winners along with the developers of the winning programs.
Please do not crack your own submission.
Best of luck. :)
Penultimate standings (pending safety of Dennis' CJam 49 submission).
- CJam 49, Dennis
- CJam 62, Dennis safe
- CJam 91, Dennis safe
- Python 156, Maarten Baert safe
- Perl 256, chilemagic safe
- Java 468, Geobits safe
- Peter Taylor [Ruby 130, Java 342, Mathematica 146*, Mathematica 72*, CJam 37]
- Dennis [Pyth 13, Python 86*, Lua 105*, GolfScript 116, C 239*]
- freddieknets [Mathematica 67*]
- Ilmari Karonen [Python27 182*]
- nitrous [C 212*]
Disclaimer (Updated 11:15 PM EST, Aug 26)
With the scoring problems finally reaching critical mass (given two thirds of the cracked submissions are thus far non-compliant), I've ranked the top crackers in terms of number of submissions cracked (primary) and total number of characters in compliant cracked submissions (secondary).
As before, the exact submissions cracked, the length of the submissions, and their compliant/non-compliant status are all marked so that readers may infer their own rankings if they believe the new official rankings are unfair.
My apologies for amending the rules this late in the game.