Anagram Quines (Cops' Thread)

27

0

This is a challenge the Robbers' Thread can be found here

Your challenge is to write a program that outputs an anagram of its source code but not the original source code itself.

For example the following Python program,

print`'print*2``'*2`

prints

'print*2``print*2``'

which has all of the same characters as its original source but in a different order.

Once you have found such a program, include the output of the program as an answer omitting the program that generates it. As you might have guessed, robbers will seek to discover the program you have hidden, or any program that fits the specifications. Your goal is to make the shortest program that the robbers cannot crack.

Rules

  • As with most challenges, if your answer remains uncracked for a week you may add the intended solution to your answer and mark it as Safe. Once safe an answer cannot be cracked by robbers.

  • You do not need to include the language of the intended solution, however if you do not include the language robbers can crack it in any language predating the challenge, while if you specify the language they may only crack it in the one provided.

  • Standard rules for Quines apply.

Post Rock Garf Hunter

Posted 2017-02-24T17:41:43.810

Reputation: 55 382

My usual question: in a language where bytes don't correspond to characters, is the anagram at the byte or character level? – None – 2017-02-24T17:56:28.950

@ais523 it should be an anagram of the bytes. – Post Rock Garf Hunter – 2017-02-24T17:58:07.590

4Closely related – James – 2017-02-24T17:58:38.243

Do usual quine rules apply to robbers? Do they apply to cops? – Dennis – 2017-02-24T18:46:10.080

@Dennis Yes. (I suppose an empty program wouldn't be bad but lets just say yes) – Post Rock Garf Hunter – 2017-02-24T18:47:07.013

I suppose introducing randomness isn't allowed? – Fatalize – 2017-02-24T19:02:56.673

1@Fatalize If it does not change the output it is fine but the output must be static. – Post Rock Garf Hunter – 2017-02-24T19:03:44.430

If the program contains newline characters, does the output need to include those newlines? – Agargara – 2017-02-28T06:19:19.707

Answers

12

Brain-Flak, 231 bytes Cracked by Wheat Wizard

}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{][][][][][][][)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(

The original program uses the -A argument.

Here are the counts:

( -> 74
) -> 74
{ -> 34
} -> 34
[ -> 7
] -> 7

Riley

Posted 2017-02-24T17:41:43.810

Reputation: 11 345

Cracked! – Post Rock Garf Hunter – 2017-02-28T02:24:52.237

5

Python 2, 96 bytes, cracked by math_junkie

Output:

B97.off]xo) wnd[ri0'of{r1({r6-{r{rri) {r1(xo0'sjD;0'0'qhF=1({r{r2)4+}twnri2)wnlcof) yp) ) xomd2)

First time code golfing! Hope it's not too easy.

Agargara

Posted 2017-02-24T17:41:43.810

Reputation: 150

2I have a miserable print(''), chr() + '' so far – drolex – 2017-02-28T14:57:44.113

2Cracked! – math junkie – 2017-03-04T20:58:53.667

4

Unspecified langauge, 124 bytes,

In the theme of DJMcMayhem's answer this is the first 32 ASCII characters (aside from 0x00) printed four times each. Since none of these are visible, I have not included the actual code in my answer.

Here is the hexdump:

00000000: 0101 0101 0202 0202 0303 0303 0404 0404  ................
00000010: 0505 0505 0606 0606 0707 0707 0808 0808  ................
00000020: 0909 0909 0a0a 0a0a 0b0b 0b0b 0c0c 0c0c  ................
00000030: 0d0d 0d0d 0e0e 0e0e 0f0f 0f0f 1010 1010  ................
00000040: 1111 1111 1212 1212 1313 1313 1414 1414  ................
00000050: 1515 1515 1616 1616 1717 1717 1818 1818  ................
00000060: 1919 1919 1a1a 1a1a 1b1b 1b1b 1c1c 1c1c  ................
00000070: 1d1d 1d1d 1e1e 1e1e 1f1f 1f1f            ............

Here however is some Python that prints it (and a newline) if you would like:

print"".join(chr(x)*4for x in range(1,32))

Post Rock Garf Hunter

Posted 2017-02-24T17:41:43.810

Reputation: 55 382

4

V, 21 bytes (Safe!)


"&./124ipq|ÍÓÚîñòÿ

Note the leading newline.

Since this contains unprintables, here is a hexdump:

00000000: 0a16 1b22 262e 2f31 3234 6970 717c cdd3  ..."&./124ipq|..
00000010: daee f1f2 ff                             .....

To help people out some, here is a link to the Standard extensible V quine


Here is the original version:

ñi241"qp|Ó./ò&
ÚÍîÿ

Try it online!

The readable version is:

ñi<C-v>241<esc>"qp|Ó./ò&
ÚÍîÿ

The way this works is by embedding sort into the default extensible quine. As I was thinking about V-quines because of this answer, I realized that the standard extensible quine can be shortedn by three bytes, so this solution could have been:

ñiéÑ~"qp|Ó./ò&
ÚÍîÿ

Explanation:

ñi<C-v>241<esc>"qp  " Standard V-quine. Everything after this is recorded into register 'q'
                    " so we can do whatever we want without ruining it's "quine-ness"


|       " Go the first character on the line (I just realized now that this is pointless)
 Ó./ò&  " Put every character on a newline
Ú       " Sort every line
 Íî     " Join all lines together
   ÿ    " Necessary for V-quines

James

Posted 2017-02-24T17:41:43.810

Reputation: 54 537

1sniff I smell fresh regex – user41805 – 2017-02-24T19:00:28.390

4

Pyth, 32 bytes, Cracked by math_junkie

J+J=JJ 1-2#pTN%"J+J=JJ 1-2#pTN%"

Original solution

J2#p+"J+J=JJ 1-2#pTN%"N=J-J1 %TJ

Try it online!

J2                               # Assign 2 to the variable J
  #                              # Infinite loop, break on error
    +"J+J=JJ 1-2#pTN%"N          # appending a '"' to the string 'J+J=JJ 1-2#pTN%'
   p                             # print the string above
                       =J-J1     # subtract 1 from J and assign back to J
                             %TJ # calculated 10%J, with a blank space before to supress output,
                                 # on the 3rd iteration this will be 10%0 that will generate an
                                 # erro and will break out the loop

Rod

Posted 2017-02-24T17:41:43.810

Reputation: 17 588

Cracked! – math junkie – 2017-03-02T02:45:33.233

4

CJam, 46 bytes, cracked by math_junkie

3658:93]93]]]95_959599c101101$::]]]]]]____ccee

Business Cat

Posted 2017-02-24T17:41:43.810

Reputation: 8 927

2Cracked! – math junkie – 2017-03-03T02:38:53.123

4

Haskell, 107 bytes, Cracked by nimi

"$$$$'''''''',,----....::<<<<<<<<========>>>>[[[[[[[[]]]]]]]]aaddddddddddddiiiiiiiiiiiimmnnnnpprrtt||||||"

There is an additional trailing newline.


Original solution:


main=print$id=<<[[id|i<-"main=print$id=<<[[id|i<-,i==d]>>d:[d]|d<-['$'..'|']]",i==d]>>d:[d]|d<-['$'..'|']]

Try it online!

My main idea was to write a quine which sorts its own source code before outputting it without using a library sort function. Only after an initial cracking try by nimi it occurred to me that the program code could be manually sorted, hard coded into the program and then printed out while doubling each letter. However the limited available characters make this approach more cumbersome and nimi's successful crack is quite similar to my original program.

Explanation:

main=print$                                      -- full program which prints the following string
  id=<<[[id|i<-"...",i==d]>>d:[d]|d<-['$'..'|']]
                                 |d<-['$'..'|']  -- for each char d in "$%&'()*+,-./012 ... xyz{|"
        [id|i<-"...",i==d]                       -- build a list with as many elements as d is contained in the string
                          >>d:[d]                -- replicate the string "dd" as often as the previous list is long 
  id=<<[                                       ] -- concatenate the resulting list of srings to one single string

Laikoni

Posted 2017-02-24T17:41:43.810

Reputation: 23 676

@nimi Yes it's a full program. Isn't this a standard rule for quines? – Laikoni – 2017-02-24T22:43:57.860

Not sure. We had quines before that allowed functions. And even if full programs are standard, the "program" in the challenge could be interpreted as overwriting the defaults and also allow functions.

– nimi – 2017-02-24T22:49:15.433

@nimi I'm sorry the previous version was misleading. I had written it after having seen your first attempt and before noticing it wasn't valid according to the specs. I even published it and then quickly rolled back in the hope that nobody saw it, as you can see in the revision history. After seeing your fixed version, I rolled back to this version, without considering that description wasn't fitting any more. – Laikoni – 2017-02-25T17:45:22.603

I was not sure if you were referring to my answer that's why I deleted my comment. It is indeed possible to use a presorted string (replace ; with a NL): i[]d=[d,d];main=print$i[]=<<"$$ ... |||"-- and all the missing characters after the --. I found this version after my answer from the robbers thread and after you revealed your answer with the now changed explanation. – nimi – 2017-02-25T18:24:35.303

3

Unspecified language, 254 bytes Cracked by @Dennis!

I doubt this will win for brevity, but it'll be a pain to crack, so it's still worth making.

Due to a bug, the order of 0x0b, 0x0c, 0x0a got a little bit mixed up, but this is definitely the real output.

I figured I wouldn't specify the language just so I could see what different languages this is possible in. Since the output is mostly non-ASCII, here is a hexdump of the output:

00000000: 0102 0304 0506 0708 090b 0c0a 0e0f 1011  ................
00000010: 1213 1415 1617 1819 1a1b 1c1d 1e1f 2021  .............. !
00000020: 2223 2425 2627 2829 2a2b 2c2d 2e2f 3031  "#$%&'()*+,-./01
00000030: 3233 3435 3637 3839 3a3b 3c3d 3e3f 4041  23456789:;<=>?@A
00000040: 4243 4445 4647 4849 4a4b 4c4d 4e4f 5051  BCDEFGHIJKLMNOPQ
00000050: 5253 5455 5657 5859 5a5b 5c5d 5e5f 6061  RSTUVWXYZ[\]^_`a
00000060: 6263 6465 6667 6869 6a6b 6c6d 6e6f 7071  bcdefghijklmnopq
00000070: 7273 7475 7677 7879 7a7b 7c7d 7e7f 8081  rstuvwxyz{|}~...
00000080: 8283 8485 8687 8889 8a8b 8c8d 8e8f 9091  ................
00000090: 9293 9495 9697 9899 9a9b 9c9d 9e9f a0a1  ................
000000a0: a2a3 a4a5 a6a7 a8a9 aaab acad aeaf b0b1  ................
000000b0: b2b3 b4b5 b6b7 b8b9 babb bcbd bebf c0c1  ................
000000c0: c2c3 c4c5 c6c7 c8c9 cacb cccd cecf d0d1  ................
000000d0: d2d3 d4d5 d6d7 d8d9 dadb dcdd dedf e0e1  ................
000000e0: e2e3 e4e5 e6e7 e8e9 eaeb eced eeef f0f1  ................
000000f0: f2f3 f4f5 f6f7 f8f9 fafb fcfd feff       ..............

That is every single ASCII character except for 0x00 and 0x0D because they both caused strange behavior on TIO. Have fun cracking! >:D


The original code was in V.

Try it online

Hexdump:

00000000: ee02 0304 0506 0708 090b 0c0e 0f10 1112  ................
00000010: 1314 1516 1718 191a 1b1c 1d1e 1f20 2122  ............. !"
00000020: 2324 2526 2728 292a 2b2c 2d2e 2f30 3132  #$%&'()*+,-./012
00000030: 3334 3536 3738 393a 3b3c 3d3e 3f40 4142  3456789:;<=>?@AB
00000040: 4344 4546 4748 494a 4b4c 4d4e 4f50 5152  CDEFGHIJKLMNOPQR
00000050: 5455 5657 5859 5a5b 5c5d 5e5f 6061 6263  TUVWXYZ[\]^_`abc
00000060: 6465 6667 6869 6a6b 6c6d 6e6f 7071 7273  defghijklmnopqrs
00000070: 7475 7677 7879 7a7b 7c7d 7e7f 8081 8283  tuvwxyz{|}~.....
00000080: 8485 8687 8889 8a8b 8c8d 8e8f 9091 9293  ................
00000090: 9495 9697 9899 9a9b 9c9d 9e9f a0a1 a2a3  ................
000000a0: a4a5 a6a7 a8a9 aaab adae afb0 b1b2 b3b4  ................
000000b0: b5b6 b7b8 b9ba bbbc bdbe bfc0 c1c2 c3c4  ................
000000c0: c5c6 c7c8 c9ca cbcc cdce cfd0 d1d2 d3d4  ................
000000d0: d5d6 d7d8 d9da dbdc ddde dfe0 e1e2 e3e4  ................
000000e0: e5e6 e7e8 e9ea ebec edef f0f1 f2f3 f4f5  ................
000000f0: f6f7 f8f9 fafb fcfd feff 0a53 ac01       ...........S..

Basically, everything up to the S just inserts garbage into the buffer. The 0xEE at the beginning is just to insure that everything after the newline doesn't happen in part of a loop or macro. Then, we do

¬<C-a>   "Insert every character in the range 0x01-0xFF

James

Posted 2017-02-24T17:41:43.810

Reputation: 54 537

2Cracked. – Dennis – 2017-02-24T18:54:04.960

2

Octave, 91 bytes

a=['111111111123666667eeegggkkknnszEEGn};:;:'];
''''''''''(),,,,,-[[[]]]aaaddip;;=ds1010]);

drolex

Posted 2017-02-24T17:41:43.810

Reputation: 290

Cracked! – math junkie – 2017-03-05T14:50:18.153

Not quite... you get an extra '' at the end of the output – drolex – 2017-03-06T07:25:32.307

Should be good now – math junkie – 2017-03-07T02:31:48.397

This is it. Well done! – drolex – 2017-03-07T06:30:50.433

2

PHP, 130 Bytes (Safe)

    $$$$$$''''(((((((()))))))),,22;;;;;;<<==??\\\\____aaccddeeeeeeeehhhhiiiillllmmoooooopppppppppprrrrrrrrssssssssttttttttttvvvvvv

Original Solution

I could not understand that it was not cracked

<?php $v=str_split(str_repeat('<?php\ $v=str_split(str_repeat(\'\',2));sort($v);echo\ implode($v);',2));sort($v);echo implode($v);

Jörg Hülsermann

Posted 2017-02-24T17:41:43.810

Reputation: 13 026

0

Guess, 43 bytes

{4"2)4q):)u(4o'{4t:q(e)(",(t22(u()o)?,?'2e

It was a tough call whether or not to share what language it was, but I think this option is better. Note that there's a trailing newline.

Bijan

Posted 2017-02-24T17:41:43.810

Reputation: 781

1An answer is only safe if you add the intended solution to the answer. Until then, this answer is not safe. – mbomb007 – 2017-05-01T18:41:50.603