# I'm thinking of a number (Cop's Thread)

In this challenge cops will think of a positive integer. They will then write a program or function that outputs one value when provided the number as input and another value for all other positive integer inputs. Cops will then reveal the program in an answer keeping the number a secret. Robbers can crack an answer by finding the number.

Here's the catch: this is not , instead your score will be the secret number with a lower score being better. Obviously you cannot reveal your score while robbers are still trying to find it. An answer that has not been cracked one week after its posting may have its score revealed and be marked safe. Safe answers cannot be cracked.

It probably goes without saying but you should be able to score your answer. That is you should know exactly what value is accepted by your decision machine. Simply knowing that there is one is not enough.

## Use of Cryptographic functions

Unlike most cops and robbers challenge which ask you not to use cryptographic functions, this challenge not only entirely allows them but encourages them. You are free to create answers in any way as long as you are trying to win. That being said, answers using other methods are also welcome here. The goal of the challenge is to win, and as long as you don't cheat nothing is off the table.

• If you allow crytographic functions, I would recommend putting a time limit on programs. – Okx Aug 28 '17 at 17:15
• I downvoted this challenge because, in most languages, it can be simply cracked using a mapping algorithm or a simple loop. I consider that a bit too easy for a cops-and-robbers challenge. – Mr. Xcoder Aug 28 '17 at 18:02
• I feel like there are going to be a lot of cops who know one (probably the smallest) accepted value but don't know if there are more right answers or what they are. – histocrat Aug 28 '17 at 18:03
• @Mr.Xcoder You are free to downvote however I will point out that that is kind of the point of the challenge and not in my opinion a flaw. The challenge is mostly fun for cops who have to make it as hard to brute force as possible by slowing down computation. More creative answers will should make brute forcing more and more difficult allowing them to use smaller and smaller numbers. – Sriotchilism O'Zaic Aug 28 '17 at 18:05
• @WheatWizard I assume it would not be winning, but it would not be possible to crack e.g. a program that just compares the input to A(9,9) where A is the Ackerman function. – flawr Aug 28 '17 at 19:00

# Tampio, Cracked

m:n tulos on luvun funktio tulostettuna m:ään, missä luku on x:n kerrottuna kahdella seuraaja, kun x on luku m:stä luettuna
x:n funktio on luku sadalla kerrottuna sadalla salattuna, missä luku on x alempana sadan seuraajaa tai nolla
x:n seuraajan edeltäjä on x
x:n negatiivisena edeltäjä on x:n seuraaja negatiivisena
nollan edeltäjä on yksi negatiivisena
x salattuna y:llä on örkin edeltäjä, missä örkki on x:n seuraajan seuraaja jaettuna y:llä korotettuna kahteen
sata on kiven kolo, missä kivi on kallio katkaistuna maanjäristyksestä
kallio on yhteenlasku sovellettuna mannerlaatan jäseniin ja tulivuoren jäseniin
tulivuori on nolla lisättynä kallioon
mannerlaatta on yksi lisättynä mannerlaattaan
maanjäristys on kallion törmäys
a:n lisättynä b:hen kolo on yhteenlasku kutsuttuna a:lla ja b:n kololla
tyhjyyden kolo on nolla
x:n törmäys on x tutkittuna kahdellatoista, missä kaksitoista on 15 ynnä 6
x ynnä y on y vähennettynä x:stä


Run with:

python3 suomi.py file.suomi --io


The instructions for installing the interpreter are included in the Github page. Please tell if you have any difficulties running this.

The program in pseudocode. The program performs very slowly because my interpreter is super inefficient. Also, I didn't use any opt-in optimizations available, which can reduce the evaluation time from several minutes to about 10 seconds.

• Is there no online interpreter for Tampio? – Shaggy Aug 28 '17 at 19:15
• @Shaggy Not yet, unfortunately. I should probably ask if it could be added to TIO. – fergusq Aug 28 '17 at 19:18
• Cracked – Sriotchilism O'Zaic Aug 29 '17 at 16:37

# Perl 6 — Cracked!

In a strict sense, this isn't an acceptable submission because it doesn't try very hard to win. Instead, it hopes to offer a pleasant puzzle.

It is a "pure math" program which is intended to be cracked by contemplation. I'm sure that you could bruteforce the solution (after cleaning up some sloppy programming I've purposefully committed), but for "full credit" (:--)), you should be able to explain what it does on the math grounds.

sub postfix:<!>(Int $n where$n >= 0)
{
[*] 1 .. $n; } sub series($x)
{
[+] (0 .. 107).map({ (i*($x % (8*π))) **$_ / $_! }); } sub prefix:<∫>(Callable$f)
{
my $n = 87931; ([+] (0 ..$n).map({
π/$n * ($_ == 0 || $_ ==$n ?? 1 !! 2) * $f(2*π *$_/$n) })).round(.01); } sub f(Int$in where $in >= 0) { ∫ { series($_)**11 / series($in *$_) }
}



You are supposed to crack the function f(). (That's the function that takes one natural number and returns one of the two results.) Warning: As shown by @Nitrodon, the program actually behaves wrongly and "accepts" an infinite number of inputs. Since I have no idea of how to fix it, I just remark for the future solvers that the number I had in mind is less than 70000.

If you try to run this in TIO, it will time out. This is intentional. (Since it's not supposed to be run at all!)

Finally, I tried to write some reasonably clear code. You should be mostly able to read it fluently even if you're not familiar with the language. Only two remarks: the square brackets [op] mean reducing ("folding", in Haskell lingo) a list with the operator op; and the sub called postfix:<!> actually defines a postfix operator named ! (i. e. used like 5! -- it does exactly what you would expect). Similarly for the prefix:<∫> one.

I hope that somebody enjoys this one, but I'm not sure if I got the difficulty right. Feel free to bash me in the comments :—).

Try it online!

# JavaScript, Cracked

I've obfuscated this as much as I can, to the point where it can't fit within this answer.

Try it here! Click Run, then type in console guess(n)

Returns undefined if you get the wrong answer, returns true otherwise.

Edit: Somehow I overlooked the part about my score being the number. Oh well, my number is very very big. Good luck solving it anyways.

# Jelly, score: ...1 (cracked)

5ȷ2_c⁼“ḍtṚøWoḂRf¦ẓ)ṿẒƓSÑÞ=v7&ðþạẆ®GȯżʠṬƑḋɓḋ⁼Ụ9ḌṢE¹’


Try it online!

1Really expected me to reveal it? Come on! Oh well, it has a score of 134. There, I said it!

• Cracked – Mr. Xcoder Aug 28 '17 at 17:59
• @Mr.Xcoder It lived long... – Erik the Outgolfer Aug 28 '17 at 17:59
• I just added Ç€G and the range 1...1000 as input :P – Mr. Xcoder Aug 28 '17 at 18:08
• You saw the 5ȷ2_ part right? – Erik the Outgolfer Aug 28 '17 at 18:09
• No, I didn't even look at the code lol. Just added the test suite and saw where the 1 is, then I have pasted the string from the beginning until the 1 in a Python script and counted the number of zeros before it... – Mr. Xcoder Aug 28 '17 at 18:22

# Python 2 (cracked)

I wouldn't suggest brute force. Hope you like generators!

print~~[all([c[1](c[0](l))==h and c[0](l)[p]==c[0](p^q) for c in [(str,len)] for o in [2] for h in [(o*o*o+o/o)**o] for p,q in [(60,59),(40,44),(19,20),(63,58),(61,53),(12,10),(43,42),(1,3),(35,33),(37,45),(17,18),(32,35),(20,16),(22,30),(45,43),(48,53),(58,59),(79,75),(68,77)]] + [{i+1 for i in f(r[5])}=={j(i) for j in [q[3]] for i in l} for q in [(range,zip,str,int)] for r in [[3,1,4,1,5,9]] for g in [q[1]] for s in [[p(l)[i:i+r[5]] for p in [q[2]] for i in [r[5]*u for f in [q[0]] for u in f(r[5])]]] for l in s + g(*s) + [[z for y in [s[i+a][j:j+r[0]] for g in [q[0]] for a in g(r[0])] for z in y] for k in [[w*r[0] for i in [q[0]] for w in i(r[0])]] for i in k for j in k] for f in [q[0]]]) for l in [int(raw_input())]][0]


Try it online!

Outputs 1 for the correct number, 0 otherwise.

• Cracked – Leaky Nun Aug 29 '17 at 11:06
• @LeakyNun Wow, a bit faster than I expected. – Sisyphus Aug 29 '17 at 11:14
• Finding a sudoku solver online isn't hard. – Leaky Nun Aug 29 '17 at 11:15
• There's some problem with your sudoku checker: you checked the horizontal lines and the vertical lines alright, but you only checked the first three cells. – Leaky Nun Aug 29 '17 at 11:20
• @LeakyNun You're right, an a should be i+a. I've fixed it, but it's cracked anyway shrug – Sisyphus Aug 29 '17 at 11:36

This is purely based on arithmetic. Note that myfun is the actual function, while h is just a helper function.

h k = sum $map (\x -> (x*x)**(-1) - 1/(x**(2-1/(fromIntegral k)))) [1..2*3*3*47*14593] myfun inp | inp == (last$ filter (\k -> h k < (-7.8015e-5)  )[1..37*333667-1]) = 1
| otherwise = 0

main = print $show$ myfun 42 -- replace 42 with your input


Try it online!

• The program must finish without error on all inputs. Does this even finish within a day on unlimited memory? – michi7x7 Aug 28 '17 at 20:47
• You do need quite a bit of memory but you certainly don't need unlimited memory. It probably depends on the implementation and on on your hardware. But it is obviously designed to take some time to compute in order to make brute force attacks difficult and encourage analyzing the program. Good luck :) – flawr Aug 28 '17 at 22:09
• Cracked? – Christian Sievers Aug 29 '17 at 2:28

# Java, Cracked by Nitrodon

import java.math.BigDecimal;

public class Main {
private static final BigDecimal A = BigDecimal.valueOf(4);
private static final BigDecimal B = BigDecimal.valueOf(5, 1);
private static final BigDecimal C = BigDecimal.valueOf(-191222921, 9);
private static BigDecimal a;
private static BigDecimal b;
private static int c;

private static boolean f(BigDecimal i, BigDecimal j, BigDecimal k, BigDecimal l, BigDecimal m) {
return i.compareTo(j) == 0 && k.compareTo(l) >= 0 && k.compareTo(m) <= 0;
}

private static boolean g(int i, int j, BigDecimal k) {
c = (c + i) % 4;
if (j == 0) {
BigDecimal l = a; BigDecimal m = b;
switch (c) {
case 0: a = a.add(k); return f(C, b, B, l, a);
case 1: b = b.add(k); return f(B, a, C, m, b);
case 2: a = a.subtract(k); return f(C, b, B, a, l);
case 3: b = b.subtract(k); return f(B, a, C, b, m);
default: return false;
}
} else {
--j;
k = k.divide(A);
return g(0, j, k) || g(1, j, k) || g(3, j, k) || g(3, j, k) || g(0, j, k) || g(1, j, k) || g(1, j, k) || g(3, j, k);
}
}

private static boolean h(int i) {
a = BigDecimal.ZERO; b = BigDecimal.ZERO; c = 0;
return g(0, i, BigDecimal.ONE);
}

public static void main(String[] args) {
int i = Integer.valueOf(args[0]);
System.out.println(!h(i) && h(i - 1) ? 1 : 0);
}
}


I wanted to try something different than the usual hash and random functions. You can pass the number as a command line argument. Outputs 1 if the correct number is given and 0 otherwise. For small numbers you can also try it online.

Hint:

The main part of the program implements a variant of a very well known algorithm. Once you know what it does, you will be able to optimize the given program to calculate the secret number.

Explanation:

This program implements the traversal of the quadratic variant (type 2) of the well known Koch curve (image from Wikipedia):

The secret number is the first iteration which doesn't pass through the point (B, C). As correctly recognized by Nitrodon, except of the first iteration we can safely ignore the recursion of all parts of the curve, which don't pass through the given point. By changing a line in the original program accordingly, we can check the correct number even in the online interpreter.

• Cracked, I think; the running time is too long to verify directly, but I checked with easier values and my crack seems to work. – Nitrodon Aug 30 '17 at 5:17

# Pyth, Cracked by Erik the Outgolfer*

I tried to obfuscate this as much as possible.

hqQl+r@G7hZ@c." y|çEC#nZÙ¦Y;åê½9{ü/ãÑª#¤
ØìjX\"¦Hó¤Ê#§T£®úåâ«B'3£zÞz~Ð£ë"\,a67Cr@G7hZ


Try it here!

*The number was 9.

# Octave, score: ???

It's pretty much guaranteed that no other number will have the exact same 20 random numbers in the end of the list of 1e8 of numbers.

function val = cnr(num)
rand("seed", num);
randomints = randi(flintmax-1,1e4,1e4);
val = isequal(randomints(end+(-20:0))(:), ...
[7918995738984448
7706857103687680
1846690847916032
6527244872712192
5318889109979136
7877935851634688
3899749505695744
4256732691824640
2803292404973568
1410614496854016
2592550976225280
4221573015797760
5165372483305472
7184095696125952
6588467484033024
6670217354674176
4537379545153536
3669953454538752
5365211942879232
1471052739772416
5355814017564672](:));
end


Outputs 1 for the secret number, 0 otherwise.

I ran this in Octave 4.2.0.

"Sleeps and other slowdowns can be removed when bruteforcing."

Good luck with that :)

• it doesn't seem to even run on tio – Okx Aug 28 '17 at 17:59
• @Okx It times out on TIO, but it does run in the desktop version. – Rɪᴋᴇʀ Aug 28 '17 at 18:01
• Why the downvote? – Sriotchilism O'Zaic Aug 28 '17 at 18:32
• @WheatWizard probably because it's theoretically possible that it has multiple numbers. Also, it's kinda boring tbh. I would have liked to see more mathy solutions, RNG is kinda boring. – Rɪᴋᴇʀ Aug 28 '17 at 18:36
• @Riker But because you're guessing at a seed to the RNG, he's using the RNG itself as his function which is actually deterministic. But yeah, considering it's relying on the difficultly of inverting what you hope is a one-way function, one might as well, just encrypt a string "true" with a random number and then the challenge almost amounts to breaking whatever encryption scheme was chosen to discover the private key. – Shufflepants Aug 29 '17 at 18:12

# Ly, score 239, cracked

(1014750)1sp[l1+sp1-]28^RrnI24^=u;


Try it online!

I'm banking on nobody knowing Ly here, although I know how easily that could change... sweats

Explanation:

(1014750)1sp[l1+sp1-]              # meaningless code that counts up to 1014750 and discards the result
28^Rr         # range from 255 to 0
nI       # get the index from the range equal to the input
24^=   # check if it's 16
u; # print the result


# Brain-Flak, score 1574 (cracked)

<>(((((((((((((((((((([([(((()()()){}){}){}])]){})))){}{}{}{}()){}){})){}{})){}{})){}((((((((()()){}){}){}){}[()]){}){}){}){}())){})){}){}{}{}){})(((((((((((((((((((()()){}){}()){}){}){}()){}){}()){}){})){}{}())){}{})){}{}){}){}){})(((((((((((((((()()){}()){}()){}){}){}()){}){}){}()){}){}){}()){}()){}()){})<>{({}[()])<>({}({})<({}({})<({}({})<({}({}))>)>)>)<>}({}<>(){[()](<{}>)}<>)


Try it online!

# dc

#!/bin/dc
[[yes]P] sy [[no]P] sn [ly sp] sq [ln sp] sr [lp ss] st [ln ss] su
?  sa
119560046169484541198922343958138057249252666454948744274520813687698868044973597713429463135512055466078366508770799591124879298416357795802621986464667571278338128259356758545026669650713817588084391470449324204624551285340087267973444310321615325862852648829135607602791474437312218673178016667591286378293
la %
d 0 r 0
=q !=r
10 154 ^ 10 153 ^ +
d la r la
<t !<u
1 la 1 la
>s !>n


Try it online!

Note: This submission has been modified since it was submitted. The original submission (below) was invalid and cracked by Sleafar in the comments below. (An input of 1 gives rise to the output yes, but there is one other number that gives the same result.)

#!/bin/dc
[[yes]P] sy [[no]P] sn [ly sp] sq [ln sp] sr
?  sa
119560046169484541198922343958138057249252666454948744274520813687698868044973597713429463135512055466078366508770799591124879298416357795802621986464667571278338128259356758545026669650713817588084391470449324204624551285340087267973444310321615325862852648829135607602791474437312218673178016667591286378293
la %
d 0 r 0
=q !=r
10 154 ^ 10 153 ^ +
d la r la
<p !<n


Try it online!

• The online interpreter returns "yes" for the input "1". Does this count as cracked now? – Sleafar Aug 30 '17 at 3:47
• @Sleafar Sigh...yes, that was a stupid mistake on my part. – John Gowers Aug 30 '17 at 6:34
• However, that means that this challenge is now invalid, since there are two inputs that make it print yes, so I'm not sure if you're allowed to claim it. I'll add a corrected version to this post, but leave the original up in case you are. – John Gowers Aug 30 '17 at 6:44

# Python 3, score: ???

There are already some answers with sha256 hashes. Here is one with modular exponentiation:

def f(n):
if n>41597712107959907: return False
print("Computing...")
for i in range(9569712): n=pow(3,n,41597712107959907)
return n==26547443852658337

import sys
print("Enter secret number:")


f returns True iff n is the secret number.

• This returns True for infinitely many values. – John Gowers Aug 30 '17 at 8:32
• oh, you are right of course. it should return false when the input is larger than 41597712107959907. – Lukas Boersma Aug 30 '17 at 12:39
• That's a good first step, but it's not necessarily enough to guarantee that there is only one solution. 3 is not a generator of the multiplicative group Z_41597712107959907*, which means that some numbers may have more than one logarithm to base 3, or none at all. It's plausible that there's some other path that gets you to 26547443852658337 in 9569712 steps. – John Gowers Aug 30 '17 at 12:55

# Ruby, safe, score:

63105425988599693916

#!ruby -lnaF|
if /^#{eval [$F,0]*"**#{~/$/}+"}$/ &&$_.to_i.to_s(36)=~/joe|tim/
p true
else
p false
end


Try it online!

Explanation:

The first conditional checks the input number for narcissism. The thread I originally wrote for was coincidentally bumped around the same time I posted this, but I guess nobody noticed. The second converts the number to base 36, which uses letters as digits, and checks if the string contains "joe" or "tim". It can be proven (through exhaustion) that there is only one narcissistic number named either Joe or Tim (Joe), because the narcissistic numbers are finite. Proof that they're finite: the result of taking an n-digit number, raising each digit to the nth power, and summing is bounded above by n*9^n, while the value of an n-digit number is bounded below by n^10. The ratio between these terms is n*(9/10)^n, which eventually decreases monotonically as n increases. Once it falls below 1, there can be no n-digit narcissistic numbers.

# PHP, safe, score:

60256

<?php

$a =$argv[1];

$b ='0123456789abcdefghijklmnopqrstuvwxyz';$c = strlen($b);$d = '';
$e =$a;
while ($e) {$d .= $b[$e % $c];$e = floor($e /$c);
}

echo ((function_exists($d) &&$d(\$a) === '731f62943ddf6733f493a812fc7aeb7ec07d97b6') ? 1 : 0) . "\n";


Outputs 1 if correct, 0 otherwise.

Edit: I don't think anyone even tried to crack this because:

it would be easy to brute force.

Explanation:

I take the input and convert it to "base 36", but I don't reverse the remainders to produce the final number. The number 60256 is "1ahs" in base 36. Unreversed, that is "sha1", which is a function in PHP. The final check is that sha1(60256) equals the hash.

# Swift 3 (53 bytes) - Cracked

func f(n:Int){print(n==1+Int(.pi*123456.0) ?222:212)}


How to run this? – f(n:1).

Test Here.

• Cracked – Mr. Xcoder Aug 28 '17 at 18:34
• @Mr.Xcoder Heh well done, guess it was too easy – user70974 Aug 28 '17 at 18:35

# Python 3, score: ???

Hopefully this, if anything, demonstrates how broken of a problem this really is:

from hashlib import sha3_512

hash_code = 'c9738b1424731502e1910f8289c98ccaae93d2a58a74dc3658151f43af350bec' \
'feff7a2654dcdd0d1bd6952ca39ae01f46b4260d22c1a1b0e38214fbbf5eb1fb'

def inc_string(string):
length = len(string)
if length == 0 or all(char == '\xFF' for char in string):
return '\x00' * (length + 1)
new_string = ''
carry = True
for i, char in enumerate(string[::-1]):
if char == '\xFF' and carry:
new_string = '\x00' + new_string
carry = True
elif carry:
new_string = chr(ord(char) + 1) + new_string
carry = False
if not carry:
new_string = string[0:~i] + new_string
break
return new_string

def strings():
string = ''
while True:
yield string
string = inc_string(string)

def hash_string(string):
return sha3_512(string.encode('utf-8')).hexdigest()

def main():
for string in strings():
if hash_string(string) == hash_code:
exec(string)
break

main()


Essentially, what this code does is lazily generate every string possible until one of the strings has a hash that exactly matches hash_code above. The unhashed code takes the basic form of:

num = int(input('Enter a number:\n'))
if num == <insert number here>:
print(1)
else:
print(0)


Except <insert number here> is replaced with a number and there are comments in the code for the purpose of making the code nearly unguessable.

I've taken every precaution to ensure that I do not benefit from this post. For starters, it's community wiki so I will not gain rep for it. Also, my score is rather large, so hopefully a much more creative answer will come along and win.

Hope you all aren't too furious at my response, I just wanted to show off why cops and robbers posts usually ban hashing algorithms.

• Input is taken from stdin. Output is a 1 (for a correctly guessed number) or a 0 (for an incorrectly guessed one). – sonar235 Aug 28 '17 at 23:54
• I don't know why you have made this a community wiki. This is your answer that looks like it took considerable work to make. I certainly wouldn't call this answer evidence of the question being broken either. This is a clever answer, that could likely score well, (I can't even prove this doesn't work for 1). The point of a question is always to attract answers that approach the question in clever interesting ways (and also to have fun but I can't vouch for your entertainment), and as far as I'm concerned this does that. – Sriotchilism O'Zaic Aug 29 '17 at 0:01
• In fact this answer is invalid. It will almost certainly (with astronomical probability of no string of length 512 bits matching the hash) exec() something else that probably isn't even valid python code before reaching the intended code. – Joshua Aug 29 '17 at 18:03
• @sonar235: Your fragment template has more than 512 bits in it. – Joshua Aug 29 '17 at 19:28
• To expand on Joshua's answer: your bit of code is 102 characters long. In particular, your program will iterate over every 100-character string before it gets to your code. Since your code iterates over characters in the range 0x00-0xFF, that is 256 ^ 100 or 2 ^ 800 strings. Meanwhile, there are only 2 ^ 512 possible 512-bit hashes. That means that the strings you iterate over outnumber the possible hashes at least 2 ^ 288 to one - a number 10,000 times greater than the number of atoms in the universe. The probability of that particular hash going unused is incredibly small. – John Gowers Aug 29 '17 at 21:55

# Python 3, 49 bytes, Cracked by sonar235

x = input()
print(int(x)*2 == int(x[-1]+x[0:-1]))


Try it online!

• Zero is not a postive integer fyi. I don't know if that was the intended solution but it does work. – Sriotchilism O'Zaic Aug 28 '17 at 21:43
• 0 is not the intended solution. – E.D. Aug 28 '17 at 21:44
• Uhh, your TIO page is showing the solution... – LyricLy Aug 28 '17 at 22:20
• Also "write a program or function that outputs one value when provided the number as input and another value for all other positive integer inputs" – Jonathan Allan Aug 28 '17 at 22:50
• – Dom Hastings Aug 29 '17 at 7:26

# Java, score: 3141592 (Cracked)

\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0063\u006c\u0061\u0073\u0073\u0020\u004d\u0061\u006e\u0067\u006f\u0020\u007b
\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0076\u006f\u0069\u0064\u0020\u0063\u006f\u006e\u0076\u0065\u0072\u0074\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u0020\u0073\u0029\u007b\u0066\u006f\u0072\u0028\u0063\u0068\u0061\u0072\u0020\u0063\u0020\u003a\u0020\u0073\u002e\u0074\u006f\u0043\u0068\u0061\u0072\u0041\u0072\u0072\u0061\u0079\u0028\u0029\u0029\u007b\u0020\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u0028\u0022\u005c\u005c\u0075\u0030\u0030\u0022\u002b\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u002e\u0074\u006f\u0048\u0065\u0078\u0053\u0074\u0072\u0069\u006e\u0067\u0028\u0063\u0029\u0029\u003b\u007d\u007d
\u0070\u0075\u0062\u006c\u0069\u0063\u0020\u0073\u0074\u0061\u0074\u0069\u0063\u0020\u0076\u006f\u0069\u0064\u0020\u006d\u0061\u0069\u006e\u0028\u0053\u0074\u0072\u0069\u006e\u0067\u005b\u005d\u0020\u0061\u0072\u0067\u0073\u0029\u0020\u007b\u0069\u006e\u0074\u0020\u0078\u0020\u0020\u003d\u0020\u0049\u006e\u0074\u0065\u0067\u0065\u0072\u002e\u0070\u0061\u0072\u0073\u0065\u0049\u006e\u0074\u0028\u0061\u0072\u0067\u0073\u005b\u0030\u005d\u0029\u003b
\u0064\u006f\u0075\u0062\u006c\u0065\u0020\u0061\u003d\u0020\u0078\u002f\u0038\u002e\u002d\u0033\u0039\u0032\u0036\u0039\u0039\u003b\u0064\u006f\u0075\u0062\u006c\u0065\u0020\u0062\u0020\u003d\u0020\u004d\u0061\u0074\u0068\u002e\u006c\u006f\u0067\u0031\u0030\u0028\u0028\u0069\u006e\u0074\u0029\u0020\u0028\u0078\u002f\u004d\u0061\u0074\u0068\u002e\u0050\u0049\u002b\u0031\u0029\u0029\u002d\u0036\u003b
\u0053\u0079\u0073\u0074\u0065\u006d\u002e\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0028\u0061\u002f\u0062\u003d\u003d\u0061\u002f\u0062\u003f\u0022\u0046\u0061\u0069\u006c\u0022\u003a\u0022\u004f\u004b\u0022\u0020\u0029\u0029\u003b
\u007d\u007d

• I don't think the obfuscation is going to do anything except add an annoying first step. – Engineer Toast Aug 29 '17 at 19:09
• Cracked – pppery Aug 29 '17 at 19:11
• @EngineerToast no, not really, it was purely for scaring off lazy people. – user902383 Aug 29 '17 at 19:40

# Python 3, score 1 (safe)

Not a very interesting solution, but better a safe cop than a dead cop.

import hashlib

def sha(x):
return hashlib.sha256(x).digest()

x = input().encode()
original = x

for _ in range(1000000000):
x = sha(x)

print(int(x==b'3\xdf\x11\x81\xd4\xfd\x1b\xab19\xbd\xc0\xc3|Y~}\xea83\xaf\xa5\xb4]\xae\x15wN*!\xbe\xd5' and int(original.decode())<1000))


Outputs 1 for the target number, 0 otherwise. Input is taken from stdin. The last part (and int(original.decode())<1000) exists only to ensure only one answer, otherwise there would obviously be infinitely many answers.

• For future robbers: The integer doesn't seem to be in smaller than 100000000. – Mr. Xcoder Aug 28 '17 at 19:16
• @Shaggy It will timeout on TIO, it took about half an hour on my computer to run the billion iterations of SHA256. – L3viathan Aug 28 '17 at 19:54
• Any robbers fancy forming a team to solve this one? We just need to split the numbers less than 1000 up among us so we have time to compute the iterated-SHA digests before the deadline. – John Gowers Aug 29 '17 at 22:05
• @JohnGowers do you know BOINC? I would run that. – NieDzejkob Sep 1 '17 at 16:36

# C (gcc), score ???

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <wmmintrin.h>

#include <openssl/bio.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>

union State
{
uint8_t u8[128];
__m128i i128[8];
} state;

void encrypt()
{
BIO *key = BIO_new_mem_buf
(
"-----BEGIN PUBLIC KEY-----\n"
"wyFyEntgz8SGUl4aPJkPCgHuJhFMyUflDTywpke3KkSv3V/VjRosn+yRu5mbA/9G\n"
"mnOvSVBFn3P2rAOTbwIDAQAB\n"
"-----END PUBLIC KEY-----\n",
-1
);

RSA *rsa = PEM_read_bio_RSA_PUBKEY(key, &rsa, NULL, NULL);

uint8_t ciphertext[128];

memcpy(state.u8, ciphertext, 128);
}

void verify()
{
if (memcmp
(
"\x93\xfd\x38\xf6\x22\xf8\xaa\x2f\x7c\x74\xef\x38\x01\xec\x44\x19"
"\x76\x56\x27\x7e\xc6\x6d\xe9\xaf\x60\x2e\x68\xc7\x62\xfd\x2a\xd8"
"\xb7\x3c\xc9\x78\xc9\x0f\x6b\xf0\x7c\xf8\xe5\x3c\x4f\x1c\x39\x6e"
"\xc8\xa8\x99\x91\x3b\x73\x7a\xb8\x56\xf9\x28\xe7\x2e\xb2\x82\x5c"
"\xb8\x36\x24\xfb\x26\x96\x32\x91\xe5\xee\x9f\x98\xdf\x44\x49\x7b"
"\xbc\x6c\xdf\xe9\xe7\xdd\x26\x37\xe5\x3c\xe7\xc0\x2d\x60\xa5\x2e"
"\xb8\x1f\x7e\xfd\x4f\xe0\x83\x38\x20\x48\x47\x49\x78\x18\xfb\xd8"
"\x62\xaf\x0a\xfb\x5f\x64\xd1\x3a\xfd\xaf\x4b\xaf\x93\x23\xf4\x36",
state.u8,
128
))
exit(0);
}

static inline void quarterround(int offset)
{
int dest = (offset + 1) % 8, src = offset % 8;

state.i128[dest] = _mm_aesenc_si128(state.i128[src], state.i128[dest]);
}

int main(int argc, char *argv[])
{
if (argc != 2)
exit(0);

uint64_t input = strtoull(argv[1], NULL, 0);

state.i128[0] = _mm_set_epi32(0, 0, input >> 32, input);

for (uint64_t round = 0; round < 0x1p45; round += 2)
{
quarterround(0);
quarterround(2);
quarterround(4);
quarterround(6);

quarterround(7);
quarterround(1);
quarterround(3);
quarterround(5);
}

encrypt();
verify();
puts("something");
}


Since cryptographic solutions are encouraged, here. Exactly one positive integer will print something, all others will print nothing. This takes a long time, so it cannot be tested online.

# Java, 164517378918, safe

import java.math.*;import java.util.*;
public class T{
static boolean f(BigInteger i){if(i.compareTo(BigInteger.valueOf(2).pow(38))>0)return false;if(i.longValue()==0)return false;if(i.compareTo(BigInteger.ONE)<0)return false;int j=i.multiply(i).hashCode();for(int k=3^3;k<2000;k+=Math.abs(j%300+1)){j+=1+(short)k+i.hashCode()%(k+1);}return i.remainder(BigInteger.valueOf(5*(125+(i.hashCode()<<11))-7)).equals(BigInteger.valueOf(0));}
@SuppressWarnings("resource")
public static void main(String[]a){long l=new Scanner(System.in).nextLong();boolean b=false;for(long j=1;j<10;j++){b|=f(BigInteger.valueOf(l-j));}System.out.println(f(BigInteger.valueOf(l))&&b);}
}


# TI-BASIC, score: 196164532 non-competing

Returns 1 for secret number, 0 otherwise.

Ans→rand
rand=1


Refer to the note on this page on the rand command for more info.

• Is this guaranteed to have exactly one matching input number? – Rɪᴋᴇʀ Aug 29 '17 at 15:20
• @Riker: I think the TI calculator uses some kind of floating point internally; if RAND uses the same floating point as the rest of it, I'm pretty sure there's only 1 solution. – Joshua Sep 3 '17 at 15:23
• @Joshua I believe it uses L'Ecuyer's Algorithm. – kamoroso94 Sep 3 '17 at 15:30
• @Joshua "pretty sure" isn't enough. Unless you can prove that only 1 solution exists, this isn't a valid answer. – Rɪᴋᴇʀ Sep 3 '17 at 16:26
• @Dennis: Probe for 196164532*2; if that's not a solution than there is no other solution. – Joshua Sep 9 '17 at 3:06

# Python 3, score:?

def check(x):
if x < 0 or x >= 5754820589765829850934909 or pow(x, 18446744073709551616, 5754820589765829850934909) != 2093489574700401569580277 or x % 4 != 1:
return "No way ;-("
return "Cool B-)"


Try it online!

Simple, but may take some time to brute-force ;-) Looking forward to a fast crack ;-)

Footnote: the first two and the last conditions make the answer unique.

BTW how the score is calculated?

Hint 1

You may expect there will be 264 answers within 0 <= x < [the 25-digit prime], but actually there are only 4, and the last condition eliminates the other 3. If you can crack this, then you will also know the other 3 solutions.

# Aceto, safe

  P'*o*7-9JxriM'lo7*9Yxx.P',xe*ikCKxlI.D+∑\a€'#o*84/si5s:i»I9Ji8:i+∑€isi.s1+.i2\H/iQxsUxsxxsxiss*i1dJi/3d2*Ji-d*id*IILCh98*2JixM'e9hxBNRb!p


Outputs TrueFalse if correct, FalseFalse otherwise

The number was

15752963

Try it online!

## C#, Mono, Linux, Alpha, score 1 (safe)

class Program
{
public static void Main()
{
//Excluding out-of-range inputs at ppperry's request; does not change solution
//original code:
int i;
if (!int.TryParse(System.Console.ReadLine(), out i || i <= 0 || i > 1000000) { System.Console.WriteLine(0); Environment.Exit(0); }
var bytes = System.BitConverter.GetBytes((long)i);
using (var x = System.Security.Cryptography.HashAlgorithm.Create("MD5"))
{
for (int i = 0; i < 1000000; ++i)
for (int j = 0; j < 86400; ++j)
bytes = x.ComputeHash(bytes);
}
if (bytes[0] == 91 && bytes[1] == 163 && bytes[2] == 41 && bytes[3] == 169)
System.Console.WriteLine(1);
else
System.Console.WriteLine(0);
}
}


Careful. I mean it. There's plenty of alpha simulators out there. Use one with a jitter or this won't finish.

This depends on the fact that Alpha is big-endian, causing System.BitConverter to do the wrong thing if somebody tries this on x86 or x64. I wrote this answer to demonstrate the badness of the challenge more than anything else.

• This can't have exactly one solution; there are an infinite number of integers, and the MD5 function has a finite number of possible outputs, so there must be a collision – pppery Aug 29 '17 at 19:16
• @ppperry: There are only 2 billion and change positive ints though. – Joshua Aug 29 '17 at 19:24
• If you think about it that way, this errors on inputs greater than 2^31, and thus is invalid. – pppery Aug 29 '17 at 19:34
• @ppperry: There now it won't error on that. – Joshua Aug 29 '17 at 19:42
• Unless you can prove that 1 is the only solution, this answer is invalid. The burden of proof should be on the person claiming to have a valid answer. – Dennis Sep 6 '17 at 4:03