55
\$\begingroup\$

For the purpose of this challenge, we'll define whitespace as only linefeeds (0x0A) and spaces (0x20). Note that most languages and regex flavours consider many other characters as whitespace as well, both inside and outside the ASCII range so you might not be able to make use of the corresponding built-ins.

The Cops' Challenge

You should write a program or function in a language of your choice, which takes a string, consisting of ASCII (except NUL) characters, as input and outputs it with all whitespace removed. For example if you received the following input:

H e l l o,
 W o r l  d!

You should output

Hello,World!

Your submission will then be your source code with all whitespace removed (the same process as passing your solution as input to itself, although your solution may also contain characters outside the ASCII range). Your goal is to make it as hard as possible to figure out where whitespace needs to be inserted to recover a valid solution in your language of choice. Note that robbers may insert fewer whitespace than you removed, but not more. Also remember that robbers don't have to match your exact code, they just have to find any valid solution.

Your answer should contain the following:

  • The language (and version if necessary) in which you wrote your solution.
  • The byte count of your solution before removing whitespace.
  • Your solution with whitespace removed.

Your solution may be either a program or function, but not a snippet and you must not assume a REPL environment. You may take input via STDIN, command-line argument or function argument and output via STDOUT, function return value or function (out) parameter.

In the interest of fairness, there must be a freely available interpreter or compiler for your chosen language.

You must not use built-ins for hashing, encryption or random number generation (even if you seed the random number generator to a fixed value). Your solution must be able to process any string of 100 characters or less in under 10 seconds on a reasonable desktop machine.

If your answer has not been cracked within 7 days (168 hours), you may reveal your own solution at which point your answer is considered safe. As long as you don't reveal your solution, it may still be cracked by robbers, even if the 7 days have already passed. The shortest safe answer wins (measured before removing whitespace).

If your answer does get cracked, please indicate this in the header of your answer, along with a link to the corresponding robber's answer.

Go here for the robbers' part.

Uncracked Submissions

<script>site = 'meta.codegolf'; postID = 5686; isAnswer = false; QUESTION_ID = 103182;</script><script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script><script>jQuery(function(){var u='https://api.stackexchange.com/2.2/';if(isAnswer)u+='answers/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJeRCD';else u+='questions/'+postID+'?order=asc&sort=creation&site='+site+'&filter=!GeEyUcJFJO6t)';jQuery.get(u,function(b){function d(s){return jQuery('<textarea>').html(s).text()};function r(l){return new RegExp('<pre class="snippet-code-'+l+'\\b[^>]*><code>([\\s\\S]*?)</code></pre>')};b=b.items[0].body;var j=r('js').exec(b),c=r('css').exec(b),h=r('html').exec(b);if(c!==null)jQuery('head').append(jQuery('<style>').text(d(c[1])));if (h!==null)jQuery('body').append(d(h[1]));if(j!==null)jQuery('body').append(jQuery('<script>').text(d(j[1])))})})</script>

\$\endgroup\$
12
  • \$\begingroup\$ Related. (Inspiration, in fact.) \$\endgroup\$ Commented Dec 14, 2016 at 19:34
  • 8
    \$\begingroup\$ Seems like Whitespace would break this challenge... \$\endgroup\$ Commented Dec 14, 2016 at 19:51
  • 10
    \$\begingroup\$ @SeeOneRhino Why? The robber just has to solve the problem in Whitespace, not using more bytes than the cop. Unless a cop finds a crazily well-golfed Whitespace answer that no one can match, Whitespace answers are generally the most vulnerable in this challenge. \$\endgroup\$ Commented Dec 14, 2016 at 19:53
  • 1
    \$\begingroup\$ @SeeOneRhino Also, tabs don't count as whitespace, so they wouldn't be removed. \$\endgroup\$
    – mbomb007
    Commented Dec 14, 2016 at 20:59
  • 4
    \$\begingroup\$ No hexagony submissions this time, I guess \$\endgroup\$ Commented Dec 15, 2016 at 0:03

27 Answers 27

18
\$\begingroup\$

Haskell, 100 bytes, cracked by nimi

main=interact$iddoidlinesidwordsdoidoidoid=doiddoid<-dooiidoid<-dooiddoiddodoid

This is a full program and a dadaistic poem.


Code with withspace (Try it online!)

main=interact$id doid lines id words
doid oi d o id=do
 iddoid<-do oi id
 oid<-do o iddoid
 do d oid

Still looking quite poetic, if you ask me.

De-obfuscated

main = interact f
f s = do
 l <- lines s
 w <- words l
 id w

Explanation

The do-notation is only syntactic sugar, so f can equivalently be written as

f s = lines s >>= words >>= id

For lists the >>=-operator is defined as concatMap, so f becomes

f = concat . map id . concat . map words . lines

So given an input "a b\nc", lines splits the input at newlines ["a b","c"], words splits each line at white space yielding [["a","b"],["c"]] (as I realised only now this includes newlines, so lines actually isn't needed). Concatenating once gives ["a","b","c"], id is the identity function and as such has no effect and the final concatenation yields the string "abc".

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Do I need to say that I like dadaistic poems? \$\endgroup\$
    – Dada
    Commented Dec 14, 2016 at 21:54
  • 1
    \$\begingroup\$ my guess \$\endgroup\$
    – nimi
    Commented Dec 14, 2016 at 22:57
  • \$\begingroup\$ @nimi yes, well done. \$\endgroup\$
    – Laikoni
    Commented Dec 14, 2016 at 23:01
13
\$\begingroup\$

C, 475 bytes, cracked by Riley

Certain parts of C make it really really easy to see where whitespace should go. The c pre-processor, however, does not. So this code is sort of in two halves: up to line 17 (236 characters with whitespace) the code is virtually unobfuscated, and after that (239 characters with whitespace), good luck!

Not gonna win this competition by a long shot, but I wanted to see what could be done with the c pre-processor.

#include<unistd.h>#defineachar#defineb*#definecwrite#definedstdin#defineestdout#definefread#defineg(#defineh)#defineiwhile#definejif#definek0#definel&#definem,#definen=#defineo;#definep1#definegpmlmlh#defineabo#definemldmp#definejgdoabo#definelbabod#definegfhaboc#definejgmben#definepmlfg#definegpmlbintmain(){ajgajgmljgigpmlkmlgpmlhjgd!=''&&gpm!='\n'gfgpmlgpmlo}

Compiles (with warnings, if you enable them) with gcc -std=c89 -ansi and works like cat file | ./a.out


This was cracked much faster than I thought, congrats! My strategy was to use #defines to remove obvious token boundaries (like ';') and then use more #defines to make it REALLY unintuitive how they were shuffled around.

This, by the way, is what the code looks like after only the obvious whitespace has been added:

#include <unistd.h>
#define a char
#define b *
#define c write
#define d stdin
#define e stdout
#define f read
#define g (
#define h )
#define i while
#define j if
#define k 0
#define l &
#define m ,
#define n =
#define o ;
#define p 1
// thus begins the obfuscation
#define gpmlmlh
#define abo
#define mldmp
#define jgdoabo
#define lbabod
#define gfhaboc
#define jgmben
#define pmlfg
#define gpmlb
int main(){
    ajgajgmljgigpmlkmlgpmlhjgd!=''&&gpm!='\n'gfgpmlgpmlo
}
\$\endgroup\$
2
  • 5
    \$\begingroup\$ Welcome to PPCG! :) \$\endgroup\$ Commented Dec 15, 2016 at 13:49
  • 1
    \$\begingroup\$ Cracked This one way really fun. \$\endgroup\$
    – Riley
    Commented Dec 15, 2016 at 15:54
10
\$\begingroup\$

Octave, 69 bytes, SAFE!

@(U)eval([85329685312682956148388531268295156241''])

Input format: Newlines can't be inputted directly in the command prompt. Create the string by concatenation like this:

str = ['This is ',10,'a',10,'string']
str = This is
a
string

Call the function like this (add whitespace):

f=@(U)eval([85329685312682956148388531268295156241''])  
f(['This is ',10,'a',10,'string'])

Original code:

You only needed 66 bytes for this to work, but I wrote 69 in the header in order to not give away too much information.

The original code looks like this:

@(U)eval([853 296 853 126 829 561 48 38 853 126 829 51 562 41 ''])

Explanation:

@(U)eval(.....)    % Anonymous function taking U as the input variable

U is code point 85 in the ASCII table, so it would appear like the first space should be after 85. Wrong!

If we insert the space after 853 instead, we should get character number 853, right..? Using char to check if that's a recognizable character:

char(853)
warning: range error for conversion to character value

However, we don't use char in the code, we use the shorter version where we concatenate the numbers with an empty string [853 '']. Instead of giving an out of range error, the shorter version simply takes the numbers modulus 256.

It just so happen to be that 85+3*256 = 853. While char(853) gives a warning, [853,''] returns U.

The obvious way to do this task in Octave is:

@(U)U(U~=10&U~=32)

We know that there has to be an opening parentheses (code point 40) after the first U. 29 obviously doesn't fit so we shift the space one further right and get 296. mod(296,256) = 40. Bingo!

Continue like this and end up with the sequence:

[853 296 853 126 829 561 48 38 853 126 829 51 562 41 '']
ans = U(U~=10&U~=32)

Finally, we use eval to turn the string into code.

\$\endgroup\$
3
  • 3
    \$\begingroup\$ +1 for explaining input format in 2 lines while it took me 10 :-D \$\endgroup\$
    – Luis Mendo
    Commented Dec 16, 2016 at 0:06
  • 1
    \$\begingroup\$ Well, still no idea, except that now I recognize letter U among that bunch of numbers :-) \$\endgroup\$
    – Luis Mendo
    Commented Dec 17, 2016 at 16:33
  • 2
    \$\begingroup\$ Very good trick! It's crazy that Octave does that with character codes. I had no idea about it. But then, what can you expect when the official doc says that Octave supports Unicode by accident... :-P \$\endgroup\$
    – Luis Mendo
    Commented Dec 23, 2016 at 0:45
7
\$\begingroup\$

JavaScript ES6, 199 bytes, cracked by SLuck49

A rather bulky entry with 33 bytes of whitespace to add.

s=>eval(atob`ISYgJiAtOkI8Qk97BRBeaxZFShoUZSsiOGkMenNy`.replace(/./g,(c,i)=>String.fromCharCode(c.charCodeAt()^(k+="SecretCode".split(/\w/)[i%11].length)),k=0)).join``
\$\endgroup\$
13
  • \$\begingroup\$ Nice one.. I guess we need to add the proper amount of whitespace to "SecretCode" in order to xor the encrypted string and get the proper source~ \$\endgroup\$ Commented Dec 16, 2016 at 18:53
  • \$\begingroup\$ @PatrickRoberts Yes, exactly. \$\endgroup\$
    – Arnauld
    Commented Dec 16, 2016 at 20:32
  • \$\begingroup\$ I've already got an automated script testing all possible combinations, it's just a matter of time... wrings hands together, knowing his evil plan is working \$\endgroup\$ Commented Dec 16, 2016 at 20:33
  • \$\begingroup\$ Phew... this is taking longer than I thought. I'm thinking of writing a code golf challenge to calculate the number of permutations possible, given an array of length N and a sum S that the elements must sum to. Right now I'm at [ 10, 0, 0, 0, 0, 9, 8, 1, 5, 0, 0 ] for the gap sequence and my iteration function for the array is (a)=>{for(var x=0;!a[x];x++);if(a.length-x>1){a[0]=a[x]-1;a[x]=(x==0?a[x]:0);a[x+1]++;}else{a[0]=a[x]+1;a[x]=0;i=0}}. I started at [ 33, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]. \$\endgroup\$ Commented Dec 16, 2016 at 22:04
  • 3
    \$\begingroup\$ Obligatory movie reference \$\endgroup\$
    – Arnauld
    Commented Dec 16, 2016 at 22:30
7
\$\begingroup\$

Befunge-93, 58 bytes, Safe!

_vv$v<~:!`:<#^0*@-:0*5|845\+`-v0,<#-^<

Try it online!

Original Program

_vv
 $ v<
 ~:!`
 :<#^0
*  @
-:0
*5 |
8
45
\+`
-
v0,<
#-
^<

Try it online!

The trick to this was that the path of execution was more vertical than horizontal, then various spaces were inserted at random in the code to further shuffle the vertical paths. Once the line breaks and whitespace were finally removed, there was hopefully then very little to indicate how the operations related to each other.

In case that wasn't difficult enough, I also threw in a bit of interleaving, so a number of operations ended up being executed by different code paths flowing perpendicular to each other. The idea being that if you thought you'd found the correct position for a particular command, you wouldn't realise you might need to use it again later in the code.

Not sure if it was worth all that effort trying to make things complicated, or people didn't even bother trying to solve it. :)

Code Explanation

_      Since an empty stack is treated as zero, this initially just branches right.
v      The program flow is then directed downwards.
$      And this drop command initially does nothing because the stack is still empty.
~      A character is read from stdin.
::     Two duplicates are created.
55+-   We subtract 10 from the first copy (the 0- is just a nop to confuse things).
\48*-  And subtract 32 from the second copy.
*      The product of those two will be zero if the character is a newline or space.
_      So if we got whitespace, our branch goes right again repeating the loop.

v      If not, we go left, wrapping around till we hit the down arrow in column 3.
:<:    Again we make two duplicates of the character.
0`!|   One copy is used to compare if it's not greater than zero.
@      If it's not (i.e. it's the EOF), the branch goes up and we terminate.
<      Otherwise we go down and to the left.
,      Output the second copy of the character, leaving one remaining on the stack.
0      Push a zero to force the next branch right.
v      Redirect the flow down, wrapping to the top again.
_      Back at our initial branch, the zero we pushed forces us right.
v      Again the program flow is directed downwards.
$      And the drop command gets rid of the last duplicate character.
~      So now we're back reading the next character and the loop repeats.
\$\endgroup\$
6
\$\begingroup\$

><>, 40 bytes, Cracked by Teal pelican

v<<i/\:=::a?0/>/1?o-=="?;">^

I used fishlanguage.com by the way, just in case there are differences between interpreters.

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

C#6, 201 bytes, Cracked by Link Ng

usingSystem.Linq;_=>string./**/#iftrueJoin(/*"*//*/""/**//*/"*/",#elseConcat(//*/,#endiffrommin""letp=$@"{@""[1]}"fromiin(_.Replace(p,@""))where!new[]{p[0]^32^10}.Contains(i)select@i);

184 bytes collapsed, leaving you 17 bytes of whitespace.

Cracked solution using the Concat whereas my intended solution used the Join, here's the intended solution:

_=>string./**/
#if true
Join(/*"* //*/""/**//*/"* /",#elseConcat(//*/,
#endif
from m in" "let p=$@"{@"  "[1]}"from i in(_.Replace(p,@"
"))where!new[]{p[0]^32^10}.Contains(i)select@i);
\$\endgroup\$
2
5
\$\begingroup\$

MATL, 22 bytes. Cracked and cracked.

This is a program that takes input through STDIN and produces the output through STDOUT.

Code without spaces or newlines:

t'@*'dm1e5%Mdw%Y(

The input format is a little awkward because of how MATL takes string input. Strings with newlines cannot be entered directly through STDIN, because each input has to be a single line (newline marks the end of input). So the format is as follows:

  1. A string is enclosed with single quotes. If the string content includes single quotes, they are escaped by duplicating. Example: 'I''m a string'

  2. To enter a string with newlines one needs to split the string at newlines and concatenate everything (by means of square brackets), including numbers as ASCII codes. For example, consider the string formed by my first and last names with a newline in between. It would be entered as ['Luis' 10 'Mendo'].

    This allows entering any other (possibly non-printable) ASCII codes. So the string in item 1 above could be alternatively entered as ['I' 39 'm ' 97 32 'string']. Check it here.

    The only condition is that at least one of the parts within the brackets is a string. That forces any numbers to be interpreted as ASCII codes when concatenating.

Sorry about the awkward Good luck using this format!

Original solution

t' @ *'dm1e 5%
Mdw%Y
(

Each % is a comment symbol, and so the rest of the line is ignored.

Spaces do nothing, but serve as separators. For example, 1e5, without the space, would be interpreted as the number 100000.

t takes the input and duplicates it.

' @ *' pushes that string, and d computes its consecutive differences, which gives [32 -32 10] (the -32 is useless).

m gives a logical row array indicating which characters are 32 or 10 (or -32).

1 followed by e reshapes as a row. This is no-op here.

5 followed by M pushes 1 again (last input to the most recent multiple-input function, which is e).

d computes consecutive differentes of 1, and so gives [] (empty array).

w swaps, and finally ( assigns [] to whitespace characters, i.e. removes them.

\$\endgroup\$
4
  • 1
    \$\begingroup\$ You're lying! No way this works! (+1)... \$\endgroup\$ Commented Dec 16, 2016 at 8:14
  • 2
    \$\begingroup\$ cracked? \$\endgroup\$
    – MickyT
    Commented Dec 16, 2016 at 19:09
  • 2
    \$\begingroup\$ Crap... I didn't notice it was already cracked... Well, double cracked. \$\endgroup\$ Commented Dec 16, 2016 at 19:26
  • \$\begingroup\$ Nice work both of you! :-) Not exactly my intented solution but it works perfectly \$\endgroup\$
    – Luis Mendo
    Commented Dec 16, 2016 at 19:29
5
\$\begingroup\$

Java, 3241 + 28 Bytes for a big Integer import

This entry is solely to prove the possibility of a purely cryptographically secure entry. I believe this is within the rules, but if it is against the spirit, please let me know and I will delete out of fairness. I will leave this "unsafe" indefinitely until such a time when (and if) a crack gets found. This is a monstrosity and could surely be further optimized, but here it is.

interfacer{staticvoidmain(String[]A){Strings=",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",q=",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,",a="",b="";for(Stringt:s.split(",")){a+=t.length();}for(Stringt:q.split(",")){b+=t.length();}if((newBigInteger(a).multiply(newBigInteger(b)).toString()).equals("3649760552772806991406184564114682549877113954361462782925976763675666255653486225665808494957477900238166874367635068317805381406282572366371821972593595701388544127398102379288357379612333197280663769935384647844344358594407966485992727383589962048236726744715096711312156760311643104858212670342667229690568585229658813910569607411855770280546861422837629553847973043531578541545436967345783407835402474562087790816775240815912495599135241317")){System.out.println(A[0].replaceAll("","").replaceAll("\n",""));}}}

Out of fairness to robbers, here is it with all the "obvious" whitespace added.

interface r {

    static void main(String[] A) {
        String s = ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", q = ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,", a = "", b = "";
        for (String t : s.split(",")) {
            a += t.length();
        }
        for (String t : q.split(",")) {
            b += t.length();
        }
        if ((new BigInteger(a).multiply(new BigInteger(b)).toString()).equals("3649760552772806991406184564114682549877113954361462782925976763675666255653486225665808494957477900238166874367635068317805381406282572366371821972593595701388544127398102379288357379612333197280663769935384647844344358594407966485992727383589962048236726744715096711312156760311643104858212670342667229690568585229658813910569607411855770280546861422837629553847973043531578541545436967345783407835402474562087790816775240815912495599135241317")) {
            System.out.println(A[0].replaceAll("", "").replaceAll("\n", ""));
        }
    }
}
 

Good luck, I would love to see this cracked. In fact I will even institute an unlimited bounty on this. If at any point you do crack this, you will be awarded 500 rep infinite accolade on stack exchange (as well as likely a wonderful mathetatical paper).


\$\endgroup\$
10
  • 3
    \$\begingroup\$ Your solution and mine will likely walk down the ages uncracked. \$\endgroup\$
    – Joshua
    Commented Dec 22, 2016 at 23:33
  • 2
    \$\begingroup\$ To the downvoter, is there something illegitimate about this submision? \$\endgroup\$ Commented Dec 24, 2016 at 13:53
  • 1
    \$\begingroup\$ There is actually a trivial solution for this (that does not involve factoring an RSA-440 number equivalent), unfortunately it requires an extra ~10,000 bytes... \$\endgroup\$
    – SLuck49
    Commented Jan 3, 2017 at 13:54
  • 1
    \$\begingroup\$ @SLuck49 can you comment it to me? \$\endgroup\$ Commented Jan 3, 2017 at 15:26
  • 4
    \$\begingroup\$ Yeah, for anyone curious basically you use one space to make b=1, and you make a=364976... by using 36 spaces, 49 spaces, 76 spaces, etc... unfortunately I couldn't find a way to shorten that. Just goes to show it's usually far easier to attack a crypto-implementation than a crypto-algorithm. \$\endgroup\$
    – SLuck49
    Commented Jan 3, 2017 at 15:35
4
\$\begingroup\$

RProgN, 15 Bytes Cracked!

''`R""`R

You can toy with the code here. A relatively simple solution, hopefully the annoying nature of how RProgN handles strings will leave this uncracked.

Original Program

' ' ` R
"
" ` R

Explination

Firstly, the input is implicitly pushed to the stack. Stack: <INPUT>

Then, we use ' ' to push a space to the stack. Stack: <INPUT> " "

the ` actually tries to push a string represented by `(WORD) but because there's whitespace after it, it just pushes an empty string. Stack: <INPUT> " " ""

The R here is sugar for the Replace command. Stack: <INPUTWITHOUTSPACES>

Next, the "NEWLINE" pushes a string containing a newline, which is nice because RProgN doesn't use escapes, it just straight up lets you push a string like that. Stack <INPUTWOSPACES> "\n"

Then, we use the ` trick again, and Replace, which gives our output.

\$\endgroup\$
4
  • \$\begingroup\$ Is this supposed to work in firefox? \$\endgroup\$ Commented Dec 14, 2016 at 22:20
  • \$\begingroup\$ I'm running it in firefox, is there an issue? Can you get a screenshot? \$\endgroup\$
    – ATaco
    Commented Dec 14, 2016 at 22:21
  • \$\begingroup\$ cracked? \$\endgroup\$
    – MickyT
    Commented Dec 14, 2016 at 22:31
  • \$\begingroup\$ Well that was fast. I nearly lasted half an hour! \$\endgroup\$
    – ATaco
    Commented Dec 14, 2016 at 22:34
4
\$\begingroup\$

Ruby, 86 bytes + 1 flag = 87 (cracked by Dom Hastings)

Requires command-line flag -p.

eval"(T$}{(!//;:678?32.&&)".gsub(/|(.)/){$1&&$&.ord.^($'.count('')).chr}

The code is actually valid in this form, it's just a no-op.

\$\endgroup\$
2
  • \$\begingroup\$ This is awesome, I love it! So mean... \$\endgroup\$ Commented Dec 15, 2016 at 8:54
  • \$\begingroup\$ Cracked! \$\endgroup\$ Commented Dec 15, 2016 at 10:38
4
\$\begingroup\$

Beam, 72 bytes, Safe!

Now for a 2d language. Can be played with on TIO Nexus.

s'''>`+++)+Ss`n\
 n`sS+(+++`<``/
 >rgn\
 ^ @<(\  
     H         <
 ^    /

A fairly straight forward program without a lot in there to try and fool people.

s'''>`+++)+Ss`n\ # Sets the memory slot 0 to 0, 10 to 10 and 32 to 32. n will redirect down
 n`sS+(+++`<``/  # since memory != store. \ is a red herring and not hit.
 >rgn\           # read in from input and set store to memory value. For all characters
 ^ @<(\          # other than space, LF and end of input this will be different and n will 
     H         < # redirect down then through to the print and back to read. Space, LF and  
 ^    /          # end of input get directed to the ( which tests for 0. This will redirect 
                 # space and LF to path back to read, otherwise it will skip over and halt
\$\endgroup\$
2
  • 1
    \$\begingroup\$ I think I'll move the interpreter to Node when I have time so Dennis can add it to TIO... \$\endgroup\$ Commented Dec 14, 2016 at 23:44
  • 1
    \$\begingroup\$ I've created a Node clone of the interpreter, and Dennis has now added it to TIO! \$\endgroup\$ Commented Dec 15, 2016 at 4:06
4
\$\begingroup\$

Labyrinth, 127 bytes

);""{"".@"-;,""""":"##"*"(:"+":}-;{";;"*#{:;"#""+("-;"";;"})"";""""""""

Hopefully I did this right :) this is my first cops and robbers entry.

Original Code

 ) ;""{"".@
"-;, "" ""
"  :
" ##
" *
" (:
"  +
"  :}-;{
"    ; ;
" *#{: ;
" #    "
" +("-;"
"    ; ;
"    })"
"      ;
""""""""
\$\endgroup\$
1
  • \$\begingroup\$ Your answer is now safe, you can add your original code and an explanation. \$\endgroup\$
    – Laikoni
    Commented Feb 17, 2017 at 7:27
3
\$\begingroup\$

C, 140 bytes, cracked by Riley

Let's start with an easy one.

#include<stdio.h>intmain(){inta=getchar();while(a!=EOF){//\a=getchar();if(a!=10&&a!=32)//\\putchar(a^10^32);putchar(a);a=getchar();}}

(I hope I'm doing this right.)

\$\endgroup\$
2
  • 1
    \$\begingroup\$ Cracked. Not the indended solution as I have 1 less byte. \$\endgroup\$
    – Riley
    Commented Dec 14, 2016 at 20:16
  • \$\begingroup\$ @Riley add an extra newline on the end and you'll be fine ;) \$\endgroup\$ Commented Dec 14, 2016 at 22:03
3
\$\begingroup\$

Befunge 98, 65 bytes, cracked by Pietu1998

~v>#@>::':'0--\'[';--!8v1+!*1+j!j,v>#@

Original program

~v           >#@
 >::':'0--\'[';--!8v1+!
*1+j !j,     v     >
#@
\$\endgroup\$
1
3
\$\begingroup\$

JavaScript ES6, 380 bytes, safe

This is the kind of entry that I was initially planning to release. It's huge and has nearly no chance to win, but I think it should be cryptographically strong enough to withstand 7 days. Now, I may be proven wrong!

67 bytes of whitespace to add.

s=>{for(k=`|||`.split`|`.map(s=>s.replace(/\s/g,c=>(k-=(c<'')+1,n=n<<2|k&3),k=n=0)&&n),x=10106050295,y=-4955405499,i=32,d=2654435769,t=d*i;i--;y-=(x<<4^x>>>5)+x^t+k[t>>>11&3],t-=d,x-=(y<<4^y>>>5)+y^t+k[t&3]);returns[atob(([x,y].map(n=>String.fromCharCode(n&255,n>>8&255,n>>16&255,n>>24)).join``))](/[\n]/).join``}

Solution

This is an implementation of the Extended Tiny Encryption Algorithm. The 64-bit whitespace-encoded key expands to the following 128-bit key:

K = [0xd224de37, 0x89e34e79, 0xe34e7748, 0x939e2789]

enter image description here

Source: Wikipedia

Once decrypted and converted to ASCII, the 64-bit block [x, y] reads as c3BsaXQ=, which is the Base64 encoded representation of split.

let f =

s=>{for(k=` 
 


   

 
 

|


 
 
 
    
  |  
 
    



 

|
     
 

 
 

 `.split`|`.map(s=>s.replace(/\s/g,c=>(k-=(c<' ')+1,n=n<<2|k&3),k=n=0)&&n),x=10106050295,y=-4955405499,i=32,d=2654435769,t=d*i;i--;y-=(x<<4^x>>>5)+x^t+k[t>>>11&3],t-=d,x-=(y<<4^y>>>5)+y^t+k[t&3]);return s[atob(([x,y].map(n=>String.fromCharCode(n&255,n>>8&255,n>>16&255,n>>24)).join``))](/[ \n]/).join``}

console.log(f(`H e l l o
W o r l d`))

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I started brute forcing this thinking maybe I'll get lucky and you made each of the 4 key values have the same length (8 bits). Except it would be 16 bits each... woops. Brute force isn't going to happen, time for another approach. \$\endgroup\$
    – SLuck49
    Commented Dec 20, 2016 at 13:55
3
\$\begingroup\$

Whitespace, 81 74 bytes, Cracked!

																					

Human readable version:

ttttttttttttttttttttt (21 tab characters)

I know this is an old challenge but hopefully someone is willing to have a go at cracking this. I attempted to optimise for bytecount but it may be possible to make something shorter with the same number of tab characters.

Original Solution

   	     

  
 
 	
	  
  
 				  	
	 
 
 			   	 	 
	  	
	 
 
 				
  
 


Try it online!

Explanation

ssstsssssn ; push 32
nssn  ; label ''
sns   ; dup 32 to use as address
tnts  ; getchar and store at address 32
sns   ; dup 32 to use for later subtraction
sns   ; dup 32 to use as address
ttt   ; retrieve character value
tsst  ; subtract 32 - char
ntsn  ; jez '' if result is 0 char was a space, loop without output
sns   ; dup 32 to use as address
ttt   ; retrieve character value
ssststsn ; push 10
tsst  ; subtract char - 10
ntsn  ; jez '' if result is 0 char was a linefeed, loop without output
sns   ; dup 32 to use as address
ttt   ; retrieve character value
tnss  ; putchar since it was not a space or linefeed
nsnn  ; jump '' loop

I didn't keep notes for this solution but I think I'd tried to keep the stack low by retrieving the value repeatedly which also inflated the tab count. The hope was to force a slightly unusual approach to meet the target tab count.

@thaliaarchi's 65 byte solution saves characters by leaving non-space/newline characters on the stack when it loops, this was an alternative approach I considered but didn't end up going with (though I also had a higher bytecount there :D). The 68 byte cracked solution with reordered comparisons and a -0 constant to match the required tab count very neatly hits the target with a tidy byte saving, only leaving garbage on the stack when a newline is encountered.

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

V, 37 bytes Cracked by nmjcman101

OVrS200@"kIi|D@"Aüî|D@"

Since this has unprintables, here is the readable version:

O<esc>Vr<C-a>S200<esc>@"kIi<C-v><C-v><esc>|D@"<esc>Aüî<esc>|D@"

Or if you prefer, a hexdump:

00000000: 4f1b 5672 0153 3230 301b 4022 6b49 6916  O.Vr.S200.@"kIi.
00000010: 161b 7c44 4022 1b41 fcee 1b7c 4440 22    ..|D@".A...|D@"
\$\endgroup\$
1
  • \$\begingroup\$ Cracked That was a really cool puzzle \$\endgroup\$
    – nmjcman101
    Commented Dec 15, 2016 at 14:45
2
\$\begingroup\$

Minkolang v0.15, 88 bytes, Cracked!

$oI[dd""=$r'10'=1J,?1R]r$O3.14$$$Cdollars>$$$Ceverywhere>x

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ cracked? \$\endgroup\$
    – MickyT
    Commented Dec 18, 2016 at 21:48
2
\$\begingroup\$

Vitsy, 73 bytes, safe

This is downright evil.

5mW3m7m7m2mD&EPamX}<m15mEnl9mZD\[4m]^P-cm(D_2-3*bmD1-dmrnu-'

Good luck! 13 items of whitespace to add.

Original code:

5m
W3m7m
7m
2m
D&EPamX}
<m1
5mEn
l9mZ
D
\[4m]
^P-cm(D
_2-3*
bmD1-dmrnu-
'

Try it online!

This roughly simplifies down to:

<m1
W2\[2m]Z
l\[D&EP^P-_2-3*D1-rnu-(DX}]
\$\endgroup\$
3
  • \$\begingroup\$ Please do not look at the edit history, as I had a bug in my code remaining. \$\endgroup\$ Commented Dec 15, 2016 at 16:37
  • \$\begingroup\$ You do not know evil. I know evil. \$\endgroup\$
    – Joshua
    Commented Dec 17, 2016 at 3:11
  • \$\begingroup\$ It is just past 0300 for me, so I'll add an explanation in the morning. \$\endgroup\$ Commented Jan 1, 2017 at 3:09
1
\$\begingroup\$

C#, 159 bytes, Cracked by milk

usingSystem.Linq;s=>string.Join("",string.Join("",s.Split(@"".Replace(newstring((char)0x0D,1),"").ToCharArray())).Select(c=>c+""!=""?c+"":"").ToArray());

153 collapsed so only 6 bytes of whitespace to find, shouldn't be too hard...

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Cracked \$\endgroup\$
    – milk
    Commented Dec 15, 2016 at 19:05
1
\$\begingroup\$

reticular, 43 bytes, cracked

ISBqv<>>$$4jE:d/v$v?c+91d/v?E;!?l$/o$

The version on TIO is outdated, but you can get yourself a copy from the github.

\$\endgroup\$
5
  • \$\begingroup\$ The version on Nexus was already up-to-date. I pulled on v1 as well. \$\endgroup\$
    – Dennis
    Commented Dec 15, 2016 at 4:29
  • \$\begingroup\$ Just checking, does this work if the input contains two consecutive linefeeds? \$\endgroup\$ Commented Dec 15, 2016 at 10:22
  • \$\begingroup\$ @MartinEnder it should. It depends on whether or not the input is piped or not. When piped it should read all of stdin. \$\endgroup\$ Commented Dec 15, 2016 at 12:01
  • \$\begingroup\$ @Dennis thanks! I meant to ask you in chat. \$\endgroup\$ Commented Dec 15, 2016 at 12:01
  • \$\begingroup\$ Cracked \$\endgroup\$ Commented Dec 18, 2016 at 4:13
1
\$\begingroup\$

S.I.L.O.S, 159 bytes Safe!

loadLinedef:lblgetagetzzzz/za=256:aX=getax=Xy=Xz=xx-10x|ifxbGOTOx:by-32y|ifycGOTOx:cprintCharX:xa+1z+1x=getaifxa:b

Should be fairly trivial. It is my first cops and robbers entry.

No one attacked it, probably due to the esoteric nature of my own language. Seems like a sleazy way to slide by, but it doesn't really matter as shorter ones are safe.

loadLine
def : lbl geta get z zz
z/z
a=256
:a
X=get a
x=X
y=X
z=x
x-10
x |
if x b
GOTO x
:b
y-32
y|
if y c
GOTO x
:c
printChar X
:x
a+1
z+ 1
x=get  a
if x a
:b

Feel free to try it online

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

Wolfram, 132

Probably has more that one solution (hint: Mersenne)

StringReplace[#,""->"",Limit[x/(x-1),x->Boole[PrimeQ[
212821282128228281282128228821282128212821282-1]]]]&

Solution

StringReplace[#," "->"",Limit[x/(x-1),x->Boole[PrimeQ[
2 128 2 128 2 128 2 2 8 2 8 128 2 128 2 2 8 8 2 128 2 128 2 128 2 128 2-1]]]]&
\$\endgroup\$
6
  • \$\begingroup\$ > Your submission will then be your source code with all whitespace removed \$\endgroup\$
    – user41805
    Commented Dec 17, 2016 at 15:26
  • \$\begingroup\$ @KritixiLithos It is removed \$\endgroup\$
    – swish
    Commented Dec 17, 2016 at 15:27
  • \$\begingroup\$ What about the spaces before the second line and the newline between the first and second line? \$\endgroup\$
    – user41805
    Commented Dec 17, 2016 at 15:28
  • \$\begingroup\$ Well, you're right, it is just for readability... \$\endgroup\$
    – swish
    Commented Dec 17, 2016 at 15:29
  • \$\begingroup\$ I think you can post the solution now. \$\endgroup\$ Commented May 6, 2017 at 21:51
1
\$\begingroup\$

Vyxal, 11 bytes, 7 whitespace, cracked by lyxal

#ȧ‛(#FṘ₴#Ṙ‛

Try it Online! Should be pretty easy.

Lyxal got my intended solution exactly.

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

Vyxal 3, 11 bytes, 1 whitespace needed

#?“""₉r""₉r

Try it Online!

Should be really really easy.

\$\endgroup\$
2
  • 1
    \$\begingroup\$ You need to say how much whitespace is added. \$\endgroup\$
    – emanresu A
    Commented Feb 12 at 18:06
  • \$\begingroup\$ Cracked \$\endgroup\$ Commented Feb 12 at 18:55
0
\$\begingroup\$

tcc, 850 bytes

To avoid pasting a very long line I passed this through tr -d '\n ' | fold -b -w 60.

#!/usr/bin/tcc-run#include<stdio.h>typedefunsignedcharu;um[]
={104,105,16,152,94,131,43,42,112,214,53,207,116,170,185,210
};intmain(){uS[256];uk[256];ui,j,t;intc,n=0;FILE*f;f=fopen(_
_FILE__,"r");/*cannotfail*/while(-1!=(c=fgetc(f)))if(c==''||
c==10)k[++n]=c;fclose(f);i=0;do{S[i]=i;}while(++i!=0);j=0;i=
0;do{j=j+S[i]+k[i%n];t=S[i];S[i]=S[j];S[j]=t;}while(++i!=0);
i=0;do{if(S[i]!=m[i])j=1;}while(++i<sizeof(m));if(j==1){i=0;
do{printf("%d,",(int)S[i]);}while(++i<sizeof(m));printf("\n"
);}else{while(-1!=(c=fgetc(stdin)))if(c!=''&&c!=10)fputc(c,s
tdout);}returnj;}
\$\endgroup\$
2
  • \$\begingroup\$ Link to interpreter? \$\endgroup\$ Commented Dec 18, 2016 at 21:50
  • \$\begingroup\$ @VoteToClose: apt-get install tcc did it for me. \$\endgroup\$
    – Joshua
    Commented Dec 18, 2016 at 21:52

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.