60
\$\begingroup\$

NOTICE - This challenge is now closed. Any new answers will be ignored and the accepted answer will not change

Challenge

Write a valid program which, when just two characters in the program are changed, removed or added, completely changes the output.

The changed output must have a Levenshtein Distance of 15 or more from your original output.

The output must be non empty and finite. Your program therefore must terminate within 1 minute.

Your output must be deterministic, outputting the same thing each time you run the program. It also must not be platform dependent.

Any hash functions are disallowed, as are built in PRNGs. Similarly, seeding an RNG is not allowed.

After a period of three days, an uncracked submission will become safe. In order to claim this safety, you should edit your answer to show the correct answer. (Clarification: Until you reveal the answer, you are not safe and can still be cracked.)

Formatting

Your answer should be in the following format:

# <Language name>, <Program length>

## Code

<code goes here>

## Original Output

<output goes here>

## Changed output

<changed output goes here>

Robbers

The robbers' challenge is to find out which two characters you have changed. If a robber has cracked your solution, they will leave a comment on your answer.

You can find the robbers' thread here.

Winning

The person with the shortest uncracked solution wins.

Leaderboard

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script>site = 'meta.codegolf';postID = 5686;isAnswer = false;QUESTION_ID = 54464;var safe_list=[];var uncracked_list=[];var n=0;var bycreation=function(x,y){return (x[0][0]<y[0][0])-(x[0][0]>y[0][0]);};var bylength=function(x,y){return (x[0][1]>y[0][1])-(x[0][1]<y[0][1]);};function u(l,o){ jQuery(l[1]).empty(); l[0].sort(o); for(var i=0;i<l[0].length;i++) l[0][i][1].appendTo(l[1]); if(l[0].length==0) jQuery('<tr><td colspan="3" class="message">none yet.</td></tr>').appendTo(l[1]);}function g(p) { jQuery.getJSON('//api.stackexchange.com/2.2/questions/' + QUESTION_ID + '/answers?page=' + p + '&pagesize=100&order=desc&sort=creation&site=codegolf&filter=!.Fjs-H6J36w0DtV5A_ZMzR7bRqt1e', function(s) { s.items.map(function(a) { var he = jQuery('<div/>').html(a.body).children().first(); he.find('strike').text(''); var h = he.text(); if (!/cracked/i.test(h) && (typeof a.comments == 'undefined' || a.comments.filter(function(b) { var c = jQuery('<div/>').html(b.body); return /^cracked/i.test(c.text()) || c.find('a').filter(function() { return /cracked/i.test(jQuery(this).text()) }).length > 0 }).length == 0)) { var m = /^\s*((?:[^,;(\s]|\s+[^-,;(\s])+)\s*(?:[,;(]|\s-).*?([0-9]+)/.exec(h); var e = [[n++, m ? parseInt(m[2]) : null], jQuery('<tr/>').append( jQuery('<td/>').append( jQuery('<a/>').text(m ? m[1] : h).attr('href', a.link)), jQuery('<td class="score"/>').text(m ? m[2] : '?'), jQuery('<td/>').append( jQuery('<a/>').text(a.owner.display_name).attr('href', a.owner.link)) )]; if(/safe/i.test(h)) safe_list.push(e); else uncracked_list.push(e); } }); if (s.length == 100) g(p + 1); else { var s=[[uncracked_list, '#uncracked'], [safe_list, '#safe']]; for(var p=0;p<2;p++) u(s[p],bylength); jQuery('#uncracked_by_length').bind('click',function(){u(s[0],bylength);return false}); jQuery('#uncracked_by_creation').bind('click',function(){u(s[0],bycreation);return false}); } });}g(1);</script><link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"><style>table th,table td { padding: 5px;}th { text-align: left;}.score { text-align: right;}table a { display: block;}.main { float: left; margin-right: 30px;}.main h3,.main div { margin: 5px;}.message { font-style: italic;}</style><div class="main"><h3>Uncracked submissions</h3><table> <tr> <th>Language</th> <th class="score">Length</th> <th>User</th> </tr> <tbody id="uncracked"></tbody></table><div>Sort by: <a href="#" id="uncracked_by_length">length</a> <a href="#" id="uncracked_by_creation">creation</a></div></div><div class="main"><h3>Safe submissions</h3><table> <tr> <th>Language</th> <th class="score">Length</th> <th>User</th> </tr> <tbody id="safe"></tbody></table></div>

\$\endgroup\$
27
  • \$\begingroup\$ @BetaDecay How do you define a hash function? \$\endgroup\$
    – isaacg
    Commented Aug 11, 2015 at 8:47
  • 1
    \$\begingroup\$ @xnor Theoretically, but the number of possibilities increases hugely as the program length increases and so may take a long time \$\endgroup\$
    – Beta Decay
    Commented Aug 11, 2015 at 8:48
  • 1
    \$\begingroup\$ @RedPanda Yes, I would think so \$\endgroup\$
    – Beta Decay
    Commented Aug 11, 2015 at 10:34
  • 5
    \$\begingroup\$ @isaacg I decided to change the safe date to three days \$\endgroup\$
    – Beta Decay
    Commented Aug 12, 2015 at 7:37
  • 4
    \$\begingroup\$ Would it be possible to put the leaderboard code on fewer lines so it takes up less visual room? \$\endgroup\$
    – isaacg
    Commented Aug 13, 2015 at 0:49

76 Answers 76

39
\$\begingroup\$

Cracked

Shakespeare, 1721 bytes

I tried a Shakespeare answer. It is not short, and I had difficulties to change the output with only 2 characters, but I think I succeeded quite well. Good Luck everybody. As a side note, I used the "compiler" available at this address and it may not work with another one. (it does not work with the online interpreter) The output does not contain any unprintable characters.

Code

The Hidden Change.

Helen, a young woman with a remarkable patience.
Helena, a likewise young woman of remarkable grace.
Claudio, a remarkable man much in dispute with Claudius.
Claudius, the flatterer.
The Archbishop of Canterbury, the useless.


          Act I: Claudius's insults and flattery.

          Scene I: The insulting of Helen.

[Enter Claudius and Helen]

Claudius:
 Thou art as hairy as the sum of a disgusting horrible fatherless 
 dusty old rotten fat-kidneyed cat and a big dirty cursed war.
 Thou art as stupid as the product of thee and a fat smelly 
 half-witted dirty miserable vile weak son.
 
[Exeunt]

          Scene II: The complimenting of Helena.
          
[Enter Claudio and Helena]

Claudio:
 Thou art the sunny amazing proud healthy peaceful sweet joy.
 Thou art as amazing as the product of thee and the pretty
 lovely young gentle handsome rich Hero. Thou art as great 
 as the sum of thee and the product of a fair golden prompt good honest 
 charming loving noble king and a embroidered rich smooth golden angel.
 
[Exeunt]

          Scene III: The insulting of Claudio
          
[Enter Claudius and Helen]

Helen:
 Thou art as stupid as the sum of the sum of thee and a cat and me.
[Exit Helen]

[Enter Claudio]

Claudius:
 Thou art as stupid as the sum of thee and the product of the 
 product of me and Helen and Helena
 
[Exeunt]

          Scene IV: The Final Countdown
          
[Enter The Archbishop of Canterbury and Claudius]

Claudius:
 Thou art the sum of you and a cat.

The Archbishop of Canterbury:
 Am I better than a fine road?
 
Claudius:
 If not, let us return to the insulting of Claudio.
 
[Exit The Archbishop of Canterbury]

[Enter Claudio]

Claudius:
 Open your heart!
 Open your heart!
[Exeunt]

Original Output

11324620811132462081

Changed Output

11
\$\endgroup\$
4
  • 9
    \$\begingroup\$ Truly marvelous. This story brought tears to my eyes. \$\endgroup\$ Commented Aug 12, 2015 at 23:01
  • 6
    \$\begingroup\$ @AlexVanLiew It took me a really long time to write. It is my masterpiece! \$\endgroup\$
    – AboveFire
    Commented Aug 12, 2015 at 23:14
  • 1
    \$\begingroup\$ Cracked! \$\endgroup\$
    – plannapus
    Commented Aug 13, 2015 at 15:40
  • \$\begingroup\$ Very Nice answer \$\endgroup\$ Commented Aug 15, 2015 at 20:20
24
\$\begingroup\$

J, 76 bytes (safe)

Code

,:|.,.<,:>><|.,:>,.<|.>,:<<|.>|.,:,.<,.<,:,.<,:>|.<,:>,.|.<,:,.|.<<,:>126$a.

Original Output

┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│
││┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐││
│││┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐│││
││││┌──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐││││
│││││     ┌┬┐├┼┤└┴┘│─ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}│││││
││││└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘││││
│││└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│││
││└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘││
│└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘│
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

Changed output

┌──────────────────────┐
│┌────────────────────┐│
││┌──────────────────┐││
│││┌────────────────┐│││
││││┌──────────────┐││││
│││││┌───────────┬┐│││││
││││││0 0 0 0 0 0│││││││
│││││└───────────┴┘│││││
││││└──────────────┘││││
│││└────────────────┘│││
││└──────────────────┘││
│└────────────────────┘│
└──────────────────────┘

EDIT: Solution {: added (shown between ###)

,:|.,.<,:>><|.,:>,.<|.>,:<<|.>|.,:,.<,.<,:,.<,###{:###:>|.<,:>,.|.<,:,.|.<<,:>126$a.

Makes use of the monad {:: Map. Most of the rest of the code is useless garbage.

\$\endgroup\$
3
  • \$\begingroup\$ Note that I could certainly extend the code by a ridiculous amount of characters to make it harder to find the spot(s) where the two characters need to be added/removed/changed \$\endgroup\$
    – Fatalize
    Commented Aug 11, 2015 at 9:21
  • \$\begingroup\$ I think it's been 3 days for this one, so if you post the answer, you're safe. \$\endgroup\$
    – isaacg
    Commented Aug 14, 2015 at 20:01
  • \$\begingroup\$ @isaacg Correct, edited the answer \$\endgroup\$
    – Fatalize
    Commented Aug 14, 2015 at 20:26
12
\$\begingroup\$

Cracked

Ruby, 14

Code

x=9;puts x*9*9

Original Output

729

Changed output

99999999999999999
\$\endgroup\$
7
  • 4
    \$\begingroup\$ This looks so innocent. I've tried and I've tried, but I don't know where to get the 17 from... \$\endgroup\$
    – Dennis
    Commented Aug 11, 2015 at 21:58
  • 1
    \$\begingroup\$ I thought it was 18 9s, so I was going for something like '99'*2. wc, you betrayed me! \$\endgroup\$ Commented Aug 11, 2015 at 22:33
  • \$\begingroup\$ @AlexVanLiew 18 would be easy. Blame your shell for appending a linefeed. \$\endgroup\$
    – Dennis
    Commented Aug 11, 2015 at 22:37
  • \$\begingroup\$ @Dennis How would you do it with 18? I couldn't figure it out (but I also don't know Ruby). \$\endgroup\$ Commented Aug 11, 2015 at 22:39
  • 6
    \$\begingroup\$ Cracked \$\endgroup\$
    – Razvan
    Commented Aug 12, 2015 at 16:29
12
\$\begingroup\$

Cracked

Bash, 15 bytes

echo {{{1..9}}}

Original output

{{1}} {{2}} {{3}} {{4}} {{5}} {{6}} {{7}} {{8}} {{9}}

Modified output

1 2 3 4 5 6 7 8 9
\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – samgak
    Commented Aug 12, 2015 at 2:57
  • 2
    \$\begingroup\$ Well done. This lasted longer than I thought it would. \$\endgroup\$
    – Dennis
    Commented Aug 12, 2015 at 2:59
10
\$\begingroup\$

Cracked

Prolog, 10 bytes

Code

X is 1/42.

Original Output

X = 0.023809523809523808.

Changed output

X = -2.
\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Sp3000
    Commented Aug 11, 2015 at 15:13
  • 2
    \$\begingroup\$ For some reason I totally overlooked the fact that this can also be solved like this: X is 1//4-2., which is a lot easier to see than my original solution that @sp3000 cracked... \$\endgroup\$
    – Fatalize
    Commented Aug 12, 2015 at 21:07
10
\$\begingroup\$

Cracked

Python 2, 43 bytes

Code

print (sum(range(054321)*9876)*87654)/01234

Original Output

334960491355406

Changed output

222084148077792

The Levenshtein Distance is 15 exactly. Both the original and the changed run under 1 minute on my computer.

\$\endgroup\$
13
  • 1
    \$\begingroup\$ I've edited your post to reflect that this is a Python 2-specific submission, due to the missing parentheses for print and the multiplication of range by an integer. However, I seem to be getting MemoryErrors from the large list... \$\endgroup\$
    – Sp3000
    Commented Aug 11, 2015 at 11:27
  • 1
    \$\begingroup\$ Since this isn't code golf, you could reduce the memory load by using xrange instead of range and I believe itertools has a generator-builder that repeats a sequence x number of times. \$\endgroup\$ Commented Aug 11, 2015 at 16:43
  • 1
    \$\begingroup\$ @AlexVanLiew But the scoring is code-golf in a sense, shortest uncracked. Having said that though, there's an unnecessary space and pair of parens... or are they necessary? ;) \$\endgroup\$
    – Sp3000
    Commented Aug 11, 2015 at 16:46
  • 2
    \$\begingroup\$ IMO this answer seems kind of not interesting if this relies only on changing the numbers involved (we don't know if this is the case), because in that case you can probably do shorter and the only way it will ever get cracked is just by brute force, not cleverness. \$\endgroup\$
    – Fatalize
    Commented Aug 11, 2015 at 18:13
  • 3
    \$\begingroup\$ Cracked. That was a fun one! \$\endgroup\$
    – isaacg
    Commented Aug 12, 2015 at 2:49
8
\$\begingroup\$

Cracked

BrainFuck , 504 bytes

No one should ever need to analyse a brainfuck code. This is a modified version of an earlier code, but any change in a Brainfuck code make a big difference in the output. I use the Interpreter at http://esoteric.sange.fi/brainfuck/impl/interp/i.html to test my code. Good Luck !

Code

++++++++++[->++++++++<]>>++++++[-<---------->]<-------[----------->>>-<<+<[-->->+<<]]>>>+<<>>>+++[->++++++++++<]>++.<+++++++++[->>>>>>>++++++++++<+++++<++++++++++++++<++++++++++<+++++<++++++++++<<]++++++++++>>+++++...>++>++>-->+>++++<<<<<<<.<<<[->>>>>>.<<>>>>>.<<<<<.>>>>>.<<<<<>>>.<<<<.>>>>>.<<<<.>>>>>.<<<<<.>>>>.<<<<<.>>>>.<<...>.<<<<<<]>[->>>>>.<<...>>>.<<<<.>>>>>.<<<<...>>>>.<<<<<.>>>>.<<...>.<<<<<]>[->>>>.<<>>>>>>.<<<<<<..>>>.<<<<.>>>>>.<<<<>>>>>>.<<<<<<.>>>>>>.<<<<<<>>>>.<<<<<.>>>>.<<...>.<<<<]

Original Output

 ___
/   \
|   |
\___/

Changed Output

}}}\}}}|.}}}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\\}}|.}.|///\

Note: The Changed Output contains several STX(ASCII 2) and EOT(ASCII 4) characters

Here is the version with ASCII codes in parenthesis instead of unprintable characters:

(2)}}}(2)\}}}|(2).}}}.(2)|///\\(4)}|(2).(4)}(4).(2)|///\\(4)}}|(2).(4)}(4).(2)///\\(4)}}|(2).(4)}(4).(2)|///\\(4)}}(2).(4)}(4).(2)|///\\(4)}}|(2).(4)}(4).(2)|/(4)/\\(4)}}|(2).(4)}(4).(2)|///\\(4)}}|(2).(4)}(4).(2)|///\\(4)}}|(2).(4)}(4).(2)|///\\(4)}}|(2).(4)}(4).(2)|///\\(4)}}|(2).(4)}(4).(2)|///\
\$\endgroup\$
10
  • 3
    \$\begingroup\$ You are evil. But i will find it! \$\endgroup\$
    – RedPanda
    Commented Aug 11, 2015 at 12:04
  • \$\begingroup\$ @RedPanda My code does have a structure. At least it's not random! Good luck! \$\endgroup\$
    – AboveFire
    Commented Aug 11, 2015 at 12:25
  • \$\begingroup\$ are there any unprintables in the output? \$\endgroup\$ Commented Aug 11, 2015 at 16:17
  • \$\begingroup\$ @proudhaskeller Yes sorry about that, I'll edit the post, there is a bunch of character STX(ASCII 2) and EOT(ASCII 4) \$\endgroup\$
    – AboveFire
    Commented Aug 11, 2015 at 16:31
  • 1
    \$\begingroup\$ cracked codegolf.stackexchange.com/a/54515/20370 \$\endgroup\$ Commented Aug 11, 2015 at 20:23
8
\$\begingroup\$

cracked

Wolfram Language (Mathematica or WolframAlpha), 3 bytes

Code

8.!

Original Output

40320.

Changed output

2.67182 - 0.891969 I

For those trying it on WolframAlpha the result shows up as

Mathematica graphics

I deleted my previous answer because it worked only on Mathematica and not in WolframAlpha. That put robbers behind a paywall (instead of the deserved bars), which wasn't fair.

\$\endgroup\$
3
7
\$\begingroup\$

Cracked

MATLAB / OCTAVE, 7 bytes

Code:

cos(pi)

Original output:

ans =

     -1

Changed output:

ans =

   1.5708 - 0.8814i

This gives a Levenshtein distance of exactly 15.

\$\endgroup\$
2
  • \$\begingroup\$ Cracked. \$\endgroup\$ Commented Aug 12, 2015 at 11:45
  • 3
    \$\begingroup\$ The big tipoff for me was noticing that the real part of your changed output is pi/2. From there, it wasn't hard to guess the solution. \$\endgroup\$ Commented Aug 12, 2015 at 12:51
7
\$\begingroup\$

Cracked

CJam, 8 characters

Code

"~f":i:#

Original output

17290024234092933295664461412112060373713158853249678427974319674060504032816100667656743434803884485234668769970047274563123327020396104330878852891146011372048615474145637592955298601510765168228550988848615653376

Changed output

Output after modification is here. Both take under a minute on my 2GHz laptop.

Explanation

People seem amazed at how this works. The code works like this:

"~f"       Push a string
    :i     Convert to a list of bytes [126 102]
      :#   Fold with # (power)

This calculates 126^102. The solution was:

"}\t~f"
       :i     Convert to a list of bytes [125 9 126 102]
         :#   Fold with # (power)

This calculates ((125^9)^126)^102, which is hundreds of thousands of digits long.

\$\endgroup\$
5
  • 6
    \$\begingroup\$ This is criminal. \$\endgroup\$ Commented Aug 11, 2015 at 18:50
  • \$\begingroup\$ What the... I really wanna know how this works! ;) \$\endgroup\$
    – Beta Decay
    Commented Aug 11, 2015 at 20:06
  • \$\begingroup\$ Cracked. \$\endgroup\$
    – Dennis
    Commented Aug 11, 2015 at 20:07
  • \$\begingroup\$ @BetaDecay I could explain how the original works but not Dennis's version. I wonder how Mauris meant it to be solved... \$\endgroup\$ Commented Aug 11, 2015 at 20:13
  • \$\begingroup\$ Holy bananas! WTF! \$\endgroup\$ Commented Aug 14, 2015 at 15:01
7
\$\begingroup\$

Cracked

Pyth, 8 bytes

Code:

%CG^3y21

Initial Output:

51230235128920219893

Changed Output:

58227066
\$\endgroup\$
5
  • 1
    \$\begingroup\$ The changed output equals CG mod (2^21 * 28). I don't know Pyth, so I can't see how to change (3 ^ (2 * 21)) into that... \$\endgroup\$
    – lynn
    Commented Aug 12, 2015 at 18:52
  • 1
    \$\begingroup\$ Also, CG equals sum(256**n * (122-n) for n in range(26)). \$\endgroup\$
    – lynn
    Commented Aug 12, 2015 at 18:58
  • 1
    \$\begingroup\$ The changed output also equals CG mod (2^21 * 28 * 2*n), where 1 <= n <= 4, as well as for n=6 and n=12. Also, CG is just the lowercase alphabet interpreted as a base 256 number. I wonder if there's another modulo with base 3? \$\endgroup\$ Commented Aug 12, 2015 at 20:30
  • \$\begingroup\$ %CG^2 26 or %CG^4y13, but both have a distance of 3... \$\endgroup\$
    – Jakube
    Commented Aug 14, 2015 at 9:27
  • 1
    \$\begingroup\$ Cracked? \$\endgroup\$
    – Dennis
    Commented Aug 15, 2015 at 0:33
6
\$\begingroup\$

CJam, 13 bytes (safe)

J{m!_)mQ%2b}/

Try it online.

Original output

000010010101001010001101111000111011100110100100001011101101010100011111110010010010001111111111010000010011001110001010011111000010001001110111100000010110000010000111011011110101110010000011100111100

Modified output

11101101100011110001011010000100111011000010011101100000001010100111011010011011010111101000000011101111100000000110001000111110110110101111110100101110000101110100110011110000010101110

Solution

J{m!_)ci%2b}/

Try it online.

How it works

This takes advantage of how CJam implicitly prints the entire stack after executing the program.

Simply dumping the base-2 representations of a few integers on the stack causes them to be printed without any separator, so it should be hard to figure out where one of them begins and another one ends.

The original code does the following:

J{   e# For each I from 0 to 18, do the following:
  m! e#   Calculate the factorial of I.
  _) e#   Push a copy and add 1.
  mQ e#   Compute the result's integer square root.
  %  e#   Calculate the residue of the factorial divided by the square root.
  2b e#   Push the array of base 2-digits of the resulting integer.
}/   e#

As @AndreaBiondo notes in the comments, the binary representations of 0! to 8! can be found at the beginning of the output (spaces added for clarity):

1 1 10 110 11000 1111000 1011010000 1001110110000 1001110110000000

The intended change was to replace mQ with ci, which takes the integer modulo 65536, using 16-bit character arithmetic (casting to an unsigned 16-bit character, then back to integer).

I hoped the idea of using c to replace a mathematical operator would be obscure enough.

\$\endgroup\$
4
  • \$\begingroup\$ Wow. How do you come up with this? \$\endgroup\$ Commented Aug 12, 2015 at 21:29
  • \$\begingroup\$ I tried to crack this for quite a while. I figured out part of the modified pattern, but I was missing something. It's safe now I guess. \$\endgroup\$ Commented Aug 15, 2015 at 18:52
  • \$\begingroup\$ @AndreaBiondo It is now. Thanks for reminding me. \$\endgroup\$
    – Dennis
    Commented Aug 15, 2015 at 19:27
  • \$\begingroup\$ @Dennis I had figured out that _)mQ needed to be changed to an f(x!) such that f(x!) > x! for x <= 8 and f(x!) < x! for x >= 9, because x! was obviously being modulo'ed by a number that left the factorials from 0 to 8 intact in the output. I didn't notice 9! was the first factorial bigger than 2^16. Very nice challenge anyway. \$\endgroup\$ Commented Aug 15, 2015 at 21:33
6
\$\begingroup\$

Cracked

Python 2, 58 bytes

Code

R=range(01234);print sum(m<<min(m,n)for m in R for n in R)

Original Output

2444542772018013876036977350299418162656593659528311114655474359757543862791958572561591492595632222632192542272836836649846934427359810217936317967768095940470375690509652583392001888886352103127515963142

Changed output

4669

That 15 distance rule sure made things tricky. I hope this goes well.

\$\endgroup\$
3
  • \$\begingroup\$ The fact that 4669 = 667*7 and that the last element of range(01234) is 667 is suspicious to me... \$\endgroup\$
    – Fatalize
    Commented Aug 12, 2015 at 9:12
  • \$\begingroup\$ If you print out [m<<min(m,n)for m in R for n in R] in the interpreter, you get some really spooky white-noise esque patterns. \$\endgroup\$ Commented Aug 12, 2015 at 17:12
  • 3
    \$\begingroup\$ Cracked. \$\endgroup\$
    – jimmy23013
    Commented Aug 12, 2015 at 18:52
6
\$\begingroup\$

Cracked

Python 2, 50 bytes

Original Code:

'~'*sum([(x,y)[x%2]for x in[y for y in range(8)]])

Original Output:

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'

Modified Output:

'~~~~~~~~~~~~~~~~~~~'

Not overly short, and maybe not too hard, I don't really know. I'll try to come up with something better soon.

\$\endgroup\$
9
  • \$\begingroup\$ Is that 40 tildes and then 19 tildes? And I suppose this is run in the interpreter? \$\endgroup\$ Commented Aug 13, 2015 at 16:23
  • \$\begingroup\$ Cracked, I think \$\endgroup\$ Commented Aug 13, 2015 at 16:28
  • 2
    \$\begingroup\$ A summary of what I found so far: no combination of replacing x with y, y with x, or changing the digit in the range result in 19 tildes. I also experimented with inserting a - before either x or y, and with changing % to one of + - / *, to no avail. I'm fairly certain now that 1 or 2 inserts is required. \$\endgroup\$
    – mbomb007
    Commented Aug 13, 2015 at 16:47
  • 1
    \$\begingroup\$ Okay, my first link now cracks it correctly. \$\endgroup\$ Commented Aug 13, 2015 at 16:54
  • 2
    \$\begingroup\$ I added a small explanation, I actually think this one was really clever. I don't know that I've ever even seen a set comprehension, and also relying on Python leaking y into the enclosing scope was a nice touch. \$\endgroup\$ Commented Aug 13, 2015 at 17:00
6
\$\begingroup\$

Cracked

PHP, 164 bytes

Code

$S_U_M_M_E_R = 1;
$A_U_T_U_M_N = 2;
$T_I_M_E = 1;

if ($T_I_M_E == $S_U_M_M_E_R) {
    $A_C_=$T_I_=$O_N= 'SWIM' ? 'TAN' : 'DRINK';
}

print $T_I_M_E * $A_U_T_U_M_N;

Original Output

2

Changed output

-1.1306063769532
\$\endgroup\$
2
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Dennis
    Commented Aug 14, 2015 at 14:48
  • \$\begingroup\$ Well done! I didn't think it would be that easy to be cracked. \$\endgroup\$
    – Razvan
    Commented Aug 14, 2015 at 15:19
6
\$\begingroup\$

GolfScript, 15 bytes (safe)

Code

10,{1+3?}%{*}*]

Changed code

107,{1+3?}%{^}*]

Original Output

47784725839872000000

Changed output

557154

Explainations:

10,             # numbers from 0 to 10
   {1+3?}%      # add one and raise to the cube. (%=for each)
          {*}*] # take the product and place it in a list(useless)`

Changed code

107,             # numbers from 0 to 107
    {1+3?}%      # add one and raise to the cube. (%=for each)
           {^}*] # xor them and place it in a list(useless)
\$\endgroup\$
2
  • \$\begingroup\$ I do believe this is safe now, so if you'd like to edit your post \$\endgroup\$
    – Beta Decay
    Commented Aug 15, 2015 at 10:00
  • \$\begingroup\$ @BetaDecay I am! \$\endgroup\$
    – Baconaro
    Commented Aug 15, 2015 at 12:20
5
\$\begingroup\$

Cracked

APL, 7 bytes

Code

-/3⍴157

Original output

157

Changed output

0.11479360684269167J0.37526348448410907
\$\endgroup\$
3
  • \$\begingroup\$ Is that J in the output evidence that it's a complex number? \$\endgroup\$
    – mbomb007
    Commented Aug 14, 2015 at 21:12
  • \$\begingroup\$ @mbomb007 Yes, aJb refers to the complex number a + bi. \$\endgroup\$
    – Dennis
    Commented Aug 14, 2015 at 23:31
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Dennis
    Commented Aug 15, 2015 at 21:05
4
\$\begingroup\$

Cracked

C, 53 bytes

Code

main(a,_){puts(_*_*_*_*_-1?"Expected Output":"?");}

Original Output

Expected Output

Changed output

?

Probably too easy, but who knows. (Note: it is technically system dependent but the type of system on which it fails would also fail all the other submissions here, so I figured it was a moot point).

Cracked

Edit

I made a mistake. New code which is more secure to the obvious attack:

main(a,_){puts(_*_-1||_*_*_-1||_*_*_*_-1?"Expected Output":"?");}

same outputs. New size of 65 bytes. Hopefully harder... though still probably too easy.

\$\endgroup\$
4
  • \$\begingroup\$ Cracked \$\endgroup\$
    – Jakube
    Commented Aug 11, 2015 at 13:22
  • \$\begingroup\$ Cracked \$\endgroup\$ Commented Aug 11, 2015 at 15:40
  • 2
    \$\begingroup\$ (side note - this should probably have been two answers) \$\endgroup\$
    – Sp3000
    Commented Aug 11, 2015 at 15:41
  • \$\begingroup\$ @Sp3000 You may be right, although the goal of the original was to have the same solution, I just focussed too much on the problem of odd * count (where you can turn the middle one into a /) and didn't consider the easier *0 change. \$\endgroup\$
    – LambdaBeta
    Commented Aug 11, 2015 at 15:51
4
\$\begingroup\$

Cracked by issacg

MATLAB, 20 bytes

Code

format long
sin(i^pi)

Original Output

0.331393418243797 - 1.109981778186163i

Changed Output

0.220584040749698 - 0.975367972083631i
\$\endgroup\$
3
  • \$\begingroup\$ I tried a bunch of ideas in the Octave interpreter online. Still nothing. I tried things like using sinh, asin, tan, pi^i, etc... \$\endgroup\$
    – mbomb007
    Commented Aug 13, 2015 at 19:48
  • \$\begingroup\$ @mbomb007 - I'm at a loss here too... and I'm 5th highest on StackOverflow in MATLAB overall! \$\endgroup\$
    – rayryeng
    Commented Aug 13, 2015 at 20:12
  • \$\begingroup\$ Cracked \$\endgroup\$
    – isaacg
    Commented Aug 13, 2015 at 20:15
4
\$\begingroup\$

Cracked

Octave, 20 bytes

format long;
cos(1)*1

Output:

0.540302305868140

Changed Output:

111
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – Dennis
    Commented Aug 15, 2015 at 15:15
  • \$\begingroup\$ Note: This is only: Octave, not "Octave / MATLAB", which is often the case. \$\endgroup\$ Commented Aug 15, 2015 at 15:43
4
\$\begingroup\$

CJam, 28 bytes (safe)

"jK=\~"5*)ib257b~{G$5$+}*]Jb

Try it online.

Original output

7705397905065379035618588652533563996660018265606606763127193120855297133322151462150247488267491212817218321670720380456985476811737021068519164822984561148339610474891720342171053455881107227302663880445203851079295537592154028123394687360216561235621729967011148112746984677807932995700334185726563970223018774

Modified output

16650180159137697345989048346412185774444335111603430666402604460993564226370500963166158223117360250140073061887053326627468495236957122711656527124216908303912850181595147494475577084810653496778801228980874902968634143062

Solution

"jK=\~"5*Wcib257b~{G$5$+}*]Jb

Try it online.

How it works

I went a little overboard with this one...

The original code does the following:

"jK=\~"5* e# Push "jK=\~jK=\~jK=\~jK=\~jK=\~".
)i        e# Pop the last character and cast it to integer.
b257b     e# Convert the remainder of the string from that base to base 257.
~         e# Dump all resulting base-257 digits on the stack:
          e# 137 72 124 88 81 145 85 32 28 251 118 230 53 13 245 147 256 116 187 22 224
{         e# Do the following 224 times:
  G$5$+   e#   Add copies of the 5th and 17th topmost integers on the stack
          e#   (recurrence of a lagged Fibonacci sequence).
}*        e#
]         e# Wrap the entire stack in an array.
Jb        e# Convert from base 19 to integer.
          e# The resulting integer is printed implicitly.

The intended change is replacing (i with Wci.

This leaves the repeated string untouched and pushes 65535 (by casting to an unsigned 16-bit character, then back to integer), so that the first elements of the lagged Fibonacci sequence become

87 225 162 210 73 196 142 219 175 61 40 147 0 93 75 55 103 116 237 188 108 122 176 133 135 240 251 155 224 82 181 75 23 87 139 49 148 169 84 109 110 166 52 103 83 185 78 73

and the loop is repeated 126 times.

\$\endgroup\$
3
  • \$\begingroup\$ This is safe now, isn't it? \$\endgroup\$
    – Beta Decay
    Commented Aug 15, 2015 at 9:59
  • \$\begingroup\$ @BetaDecay I pretty much used the same trick in both CJam answers, so I had to wait to post both solutions at once. It is safe now. \$\endgroup\$
    – Dennis
    Commented Aug 15, 2015 at 19:25
  • \$\begingroup\$ Once I worked out what this was, I realised there was so many things that could be tweaked that I didn't even bother trying to brute force this one... nice work :) \$\endgroup\$
    – Sp3000
    Commented Aug 16, 2015 at 5:49
4
\$\begingroup\$

Javascript, 47 (safe)

Code

for(var i=64460,x=773;i>=1324;)x=i--/x;alert(x)

Original Output

11.948938595656971

Changed output

3.679331284911481

Distance is exactly 15.

Tested in Chrome and IE.

Solution

for(var i=64460,x=773;i>>=1<324;)x=i--/x;alert(x)

This uses the bit shift assignment operator i>>=1 to make the loop interval non-linear. Also this has the amusing property that someone trying to brute force a solution will run into several variations that run infinitely.

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

Cracked

Fantom, 26

Code

Float.makeBits(1123581321)

Original Output

5.55122931E-315

Changed output

124.24518585205078

Security Through Obscurity, if nobody knows the language, nobody can crack it. Levenshtein Distance of 15. Run it in fansh.

\$\endgroup\$
2
  • \$\begingroup\$ I guess I need to learn Fantom... \$\endgroup\$
    – AboveFire
    Commented Aug 11, 2015 at 18:56
  • 2
    \$\begingroup\$ Cracked. \$\endgroup\$ Commented Aug 11, 2015 at 19:11
3
\$\begingroup\$

Cracked

CJam, 6 characters

25mse7

Original output

-1323517.5009777304

Changed output

72004899337.38588

This might be too easy. :P

\$\endgroup\$
2
  • \$\begingroup\$ Cracked? The output is slightly different in my browser (and entirely different with the Java interpreter). \$\endgroup\$
    – Dennis
    Commented Aug 11, 2015 at 22:21
  • \$\begingroup\$ @Dennis Not entirely sure why, but the changes are correct. \$\endgroup\$ Commented Aug 11, 2015 at 22:23
3
\$\begingroup\$

Cracked

Java, 149 Characters

class T{public static void main(String[]a){System.out.print(((Integer.MAX_VALUE^25214903917L)&281474976710655L)*25214903917L+11L&281474976710655L);}}

Original Output

174542852132661

Modified Output

106906909674100

Hint:

Random.java

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

Brainfuck, 100 bytes

Code

++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<[>.+<-]

Original output

ABCDEFGHIJKLMNOPQRSTUVWXYZ

Changed output

[
  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ

Note: Possibly easy to crack. But then, nothing is easy in Brainfuck.

\$\endgroup\$
13
  • 2
    \$\begingroup\$ Are there any unprintable characters in the output? \$\endgroup\$
    – Sp3000
    Commented Aug 11, 2015 at 12:43
  • \$\begingroup\$ Seems like a few got eaten but there's still a lot of unprintables left when I try and copy and paste, so I'm assuming this is it \$\endgroup\$
    – Sp3000
    Commented Aug 11, 2015 at 12:49
  • \$\begingroup\$ @Sp3000 Er- no, there shouldn't be any unprintables. Which interpreter are you using? \$\endgroup\$
    – Kurousagi
    Commented Aug 11, 2015 at 12:56
  • \$\begingroup\$ The method isn't equal to mine, either- keep trying. \$\endgroup\$
    – Kurousagi
    Commented Aug 11, 2015 at 12:57
  • 5
    \$\begingroup\$ If you can post the actual ASCII codes of the output that would be awesome. \$\endgroup\$ Commented Aug 11, 2015 at 17:19
3
\$\begingroup\$

cracked

modern Perl 5, 70

Code

@array = (qw smiles) x 11;
s/.*// foreach @array;
print "@array\n";

Original Output

A single newline.

Changed output

 mile mile mile mile mile mile mile mile mile mile

The output begins with a space and ends with a newline.

\$\endgroup\$
7
  • \$\begingroup\$ @AlexVanLiew Note that there's a space before the first m! \$\endgroup\$
    – Dennis
    Commented Aug 12, 2015 at 21:37
  • \$\begingroup\$ @Dennis Oh no! I knew it couldn't be that simple. \$\endgroup\$ Commented Aug 12, 2015 at 21:38
  • \$\begingroup\$ I'm not sure, but I think I have it... \$\endgroup\$ Commented Aug 13, 2015 at 2:01
  • \$\begingroup\$ @DomHastings Yep! Well solved. As someone commented on your solution, the additional character can be an extra space anywhere. I said "modern" Perl 5 because each applies to an array only since some version. \$\endgroup\$
    – msh210
    Commented Aug 13, 2015 at 4:22
  • 2
    \$\begingroup\$ If he hadn't cracked it, would you have said "missed it by a mile"? :D \$\endgroup\$
    – mbomb007
    Commented Aug 13, 2015 at 16:53
3
\$\begingroup\$

Cracked

Matlab, 12 bytes

Code

-sin(2:.5:3)

Original output

-0.9093   -0.5985   -0.1411

Changed output

0.4228    0.7032    0.9228
\$\endgroup\$
2
  • \$\begingroup\$ Cracked! \$\endgroup\$ Commented Aug 13, 2015 at 11:35
  • \$\begingroup\$ @StewieGriffin Hey, well done! \$\endgroup\$
    – Luis Mendo
    Commented Aug 13, 2015 at 14:06
3
\$\begingroup\$

perl, 12 bytes

cracked

Code

print sin 97

Original output

0.379607739027522

Desired output

-0.64618863474386
\$\endgroup\$
5
  • 1
    \$\begingroup\$ I can confirm it's almost certainly not print sin xx, print sin xx97, or print sin 97xx where xx is any two numbers. \$\endgroup\$ Commented Aug 13, 2015 at 3:26
  • \$\begingroup\$ Cracked! \$\endgroup\$ Commented Aug 13, 2015 at 9:37
  • \$\begingroup\$ @DomHastings indeed - well done. Out of interest how did you do that? \$\endgroup\$
    – abligh
    Commented Aug 13, 2015 at 11:36
  • 3
    \$\begingroup\$ After reading @AlexVanLiew's comment, I tested similar numbers 9.?7, 9.7?, etc, but realised it had to be an operator. Tried all I could think of in snippets like perl -e 'print map{sin((+"9${_}")x7).$/}1..9' eventually got the right combination! \$\endgroup\$ Commented Aug 13, 2015 at 12:07
  • \$\begingroup\$ @DomHastings belated +1 for your crack then. \$\endgroup\$
    – abligh
    Commented Aug 13, 2015 at 14:13
3
\$\begingroup\$

Cracked

SWI-Prolog, 54 bytes

Code

assert(d(E,F):-(print(E),print(F))). d(123456,123456).

Original Output

true.

123456123456
true.

Changed output

true.

false.
\$\endgroup\$
5
  • \$\begingroup\$ I tried to get a SWI-Prolog interpreter working the other day but couldn't, so I'll take a stab in the dark; if you remove the E and F in the print statements do you get what you want? \$\endgroup\$ Commented Aug 12, 2015 at 17:36
  • \$\begingroup\$ @AlexVanLiew I'm getting syntax errors from that \$\endgroup\$
    – Sp3000
    Commented Aug 12, 2015 at 17:52
  • \$\begingroup\$ @AlexVanLiew Incorrect \$\endgroup\$
    – Fatalize
    Commented Aug 12, 2015 at 18:05
  • \$\begingroup\$ Ah well. Worth a shot. \$\endgroup\$ Commented Aug 12, 2015 at 18:13
  • \$\begingroup\$ Cracked \$\endgroup\$
    – mgibsonbr
    Commented Aug 13, 2015 at 3:59

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.