34
\$\begingroup\$

Robber's Thread here

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.

\$\endgroup\$
22
  • 2
    \$\begingroup\$ If you allow crytographic functions, I would recommend putting a time limit on programs. \$\endgroup\$
    – Okx
    Commented Aug 28, 2017 at 17:15
  • 13
    \$\begingroup\$ 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. \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 28, 2017 at 18:02
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – histocrat
    Commented Aug 28, 2017 at 18:03
  • 15
    \$\begingroup\$ @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. \$\endgroup\$
    – Wheat Wizard
    Commented Aug 28, 2017 at 18:05
  • 2
    \$\begingroup\$ @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. \$\endgroup\$
    – flawr
    Commented Aug 28, 2017 at 19:00

22 Answers 22

10
\$\begingroup\$

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.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Is there no online interpreter for Tampio? \$\endgroup\$
    – Shaggy
    Commented Aug 28, 2017 at 19:15
  • \$\begingroup\$ @Shaggy Not yet, unfortunately. I should probably ask if it could be added to TIO. \$\endgroup\$
    – fergusq
    Commented Aug 28, 2017 at 19:18
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Wheat Wizard
    Commented Aug 29, 2017 at 16:37
5
\$\begingroup\$

Perl 6Cracked!

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!

\$\endgroup\$
4
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Nitrodon
    Commented Aug 29, 2017 at 4:45
  • \$\begingroup\$ Per @Nitrodon's crack, "While 11 is the only answer in theory, the sampling in the integral is imperfect. Consequently, any integer of the form 87931k+11 should work.". This renders this answer in violation of the challenge rules (requiring only one correct answer), and therefore subject to deletion. \$\endgroup\$ Commented May 24, 2020 at 16:59
  • \$\begingroup\$ @pppery, well, feel free to flag it if you like. I admit that there's an error, but, honestly, I don't think that it needs to be deleted because of that. And apparently a couple more people (quite more than average) thought this was worth of their upvote in spite of the error. Do as you wish, but I'm not deleting it nor fixing it. \$\endgroup\$
    – Ramillies
    Commented May 24, 2020 at 17:20
  • \$\begingroup\$ For future reference, I decided not to flag this answer for deletion (although I did flag a bunch of other answers to this question) \$\endgroup\$ Commented May 28, 2020 at 4:25
4
\$\begingroup\$

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.

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

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!

\$\endgroup\$
7
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 28, 2017 at 17:59
  • \$\begingroup\$ @Mr.Xcoder It lived long... \$\endgroup\$ Commented Aug 28, 2017 at 17:59
  • \$\begingroup\$ I just added Ç€G and the range 1...1000 as input :P \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 28, 2017 at 18:08
  • \$\begingroup\$ You saw the 5ȷ2_ part right? \$\endgroup\$ Commented Aug 28, 2017 at 18:09
  • \$\begingroup\$ 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... \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 28, 2017 at 18:22
3
\$\begingroup\$

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.

\$\endgroup\$
5
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Leaky Nun
    Commented Aug 29, 2017 at 11:06
  • \$\begingroup\$ @LeakyNun Wow, a bit faster than I expected. \$\endgroup\$
    – Sisyphus
    Commented Aug 29, 2017 at 11:14
  • \$\begingroup\$ Finding a sudoku solver online isn't hard. \$\endgroup\$
    – Leaky Nun
    Commented Aug 29, 2017 at 11:15
  • \$\begingroup\$ 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. \$\endgroup\$
    – Leaky Nun
    Commented Aug 29, 2017 at 11:20
  • \$\begingroup\$ @LeakyNun You're right, an a should be i+a. I've fixed it, but it's cracked anyway shrug \$\endgroup\$
    – Sisyphus
    Commented Aug 29, 2017 at 11:36
3
\$\begingroup\$

Haskell, cracked

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!

\$\endgroup\$
3
  • \$\begingroup\$ The program must finish without error on all inputs. Does this even finish within a day on unlimited memory? \$\endgroup\$
    – michi7x7
    Commented Aug 28, 2017 at 20:47
  • \$\begingroup\$ 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 :) \$\endgroup\$
    – flawr
    Commented Aug 28, 2017 at 22:09
  • \$\begingroup\$ Cracked? \$\endgroup\$ Commented Aug 29, 2017 at 2:28
2
\$\begingroup\$

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):

Quadratic_Koch_curve_type2_iterations.png

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.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked, I think; the running time is too long to verify directly, but I checked with easier values and my crack seems to work. \$\endgroup\$
    – Nitrodon
    Commented Aug 30, 2017 at 5:17
2
\$\begingroup\$

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.

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

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.

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

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 :)

\$\endgroup\$
7
  • \$\begingroup\$ it doesn't seem to even run on tio \$\endgroup\$
    – Okx
    Commented Aug 28, 2017 at 17:59
  • 1
    \$\begingroup\$ @Okx It times out on TIO, but it does run in the desktop version. \$\endgroup\$
    – Riker
    Commented Aug 28, 2017 at 18:01
  • 1
    \$\begingroup\$ Why the downvote? \$\endgroup\$
    – Wheat Wizard
    Commented Aug 28, 2017 at 18:32
  • 3
    \$\begingroup\$ @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. \$\endgroup\$
    – Riker
    Commented Aug 28, 2017 at 18:36
  • 1
    \$\begingroup\$ @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. \$\endgroup\$ Commented Aug 29, 2017 at 18:12
1
\$\begingroup\$

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
\$\endgroup\$
1
1
\$\begingroup\$

Brain-Flak, score 1574 (cracked)

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

Try it online!

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

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!

\$\endgroup\$
3
  • \$\begingroup\$ The online interpreter returns "yes" for the input "1". Does this count as cracked now? \$\endgroup\$
    – Sleafar
    Commented Aug 30, 2017 at 3:47
  • \$\begingroup\$ @Sleafar Sigh...yes, that was a stupid mistake on my part. \$\endgroup\$ Commented Aug 30, 2017 at 6:34
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Aug 30, 2017 at 6:44
1
\$\begingroup\$

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.

\$\endgroup\$
0
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 28, 2017 at 18:34
  • \$\begingroup\$ @Mr.Xcoder Heh well done, guess it was too easy \$\endgroup\$
    – user70974
    Commented Aug 28, 2017 at 18:35
0
\$\begingroup\$

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
\$\endgroup\$
3
  • 2
    \$\begingroup\$ I don't think the obfuscation is going to do anything except add an annoying first step. \$\endgroup\$ Commented Aug 29, 2017 at 19:09
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$ Commented Aug 29, 2017 at 19:11
  • 4
    \$\begingroup\$ @EngineerToast no, not really, it was purely for scaring off lazy people. \$\endgroup\$
    – user902383
    Commented Aug 29, 2017 at 19:40
0
\$\begingroup\$

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.

\$\endgroup\$
11
  • 1
    \$\begingroup\$ Can you add a TIO link, please? \$\endgroup\$
    – Shaggy
    Commented Aug 28, 2017 at 19:14
  • 1
    \$\begingroup\$ For future robbers: The integer doesn't seem to be in smaller than 100000000. \$\endgroup\$
    – Mr. Xcoder
    Commented Aug 28, 2017 at 19:16
  • 1
    \$\begingroup\$ @Shaggy It will timeout on TIO, it took about half an hour on my computer to run the billion iterations of SHA256. \$\endgroup\$
    – L3viathan
    Commented Aug 28, 2017 at 19:54
  • 2
    \$\begingroup\$ 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. \$\endgroup\$ Commented Aug 29, 2017 at 22:05
  • 2
    \$\begingroup\$ 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. \$\endgroup\$
    – Dennis
    Commented Sep 6, 2017 at 4:03
0
\$\begingroup\$

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"
        "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC5CBa50oQ3gOPHNt0TLxp96t+6\n"
        "i2KvOp0CedPHdJ+T/wr/ATo7Rz+K/hzC7kQvsrEcr0Zkx7Ll/0tpFxekEk/9PaDt\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];

    RSA_public_encrypt(128, state.u8, ciphertext, rsa, RSA_NO_PADDING);
    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.

\$\endgroup\$
0
\$\begingroup\$

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);}
}
\$\endgroup\$
3
  • \$\begingroup\$ Don't you need to specify the solution for your answer to be considered safe? \$\endgroup\$ Commented May 23, 2020 at 17:46
  • \$\begingroup\$ @pppery The secret number is the score for this one, is it not? \$\endgroup\$ Commented Jun 3, 2020 at 15:30
  • \$\begingroup\$ Yes, it seems like I failed to read the answer properly last week. Sorry. \$\endgroup\$ Commented Jun 3, 2020 at 18:14
0
\$\begingroup\$

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.

\$\endgroup\$
7
  • 8
    \$\begingroup\$ Is this guaranteed to have exactly one matching input number? \$\endgroup\$
    – Riker
    Commented Aug 29, 2017 at 15:20
  • \$\begingroup\$ @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. \$\endgroup\$
    – Joshua
    Commented Sep 3, 2017 at 15:23
  • \$\begingroup\$ @Joshua I believe it uses L'Ecuyer's Algorithm. \$\endgroup\$
    – kamoroso94
    Commented Sep 3, 2017 at 15:30
  • \$\begingroup\$ @Joshua "pretty sure" isn't enough. Unless you can prove that only 1 solution exists, this isn't a valid answer. \$\endgroup\$
    – Riker
    Commented Sep 3, 2017 at 16:26
  • 1
    \$\begingroup\$ @Dennis: Probe for 196164532*2; if that's not a solution than there is no other solution. \$\endgroup\$
    – Joshua
    Commented Sep 9, 2017 at 3:06
0
\$\begingroup\$

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!

\$\endgroup\$
0
\$\begingroup\$

Python 3, score unknown, Cracked by Bubbler

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.

\$\endgroup\$
1
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – Bubbler
    Commented Aug 30, 2018 at 7:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.