This rar file, when decompressed, gives a 65024-byte exe file. Requiring you to output the contents of that file would be absolutely no fun.

But you aren't required to do that. Actually, you're to do something opposite: Output a binary of the same length (65024 bytes), such that no byte equals the byte at same position in the source exe file.

This is code-golf, shortest code wins.

  • 5
    \$\begingroup\$ The binary is the rar file itself, not the extracted contents, right? \$\endgroup\$
    – pxeger
    Jan 26, 2022 at 13:16
  • 8
    \$\begingroup\$ What makes this challenge interesting? A compressed file will look almost purely random, so there doesn't seem to be a strategy to avoid byte values \$\endgroup\$
    – Luis Mendo
    Jan 26, 2022 at 13:23
  • 6
    \$\begingroup\$ Any reason why you have a rar with exe? Why not just the raw 65,024 bytes? \$\endgroup\$ Jan 26, 2022 at 14:13
  • 8
    \$\begingroup\$ @l4m2 Responding to my request for clarification with a quote from the question which I can read in front of me doesn't help. I can already read that, and it wasn't clear enough to answer my query. I think I have worked out what you meant by looking at the file sizes of the rar and the exe (the extracted exe is 65024 bytes, but the rar is 64848), but I'm still not sure. Can you please explicitly clarify the question? \$\endgroup\$
    – pxeger
    Jan 26, 2022 at 14:39
  • 5
    \$\begingroup\$ I'd also like to point out that VirusTotal flags the exe as possible malware. I think this is just a false positive because the file is so compressed that it looks like encryption, which is potentially suspicious for an exe, but I still don't suggest running it. \$\endgroup\$
    – pxeger
    Jan 26, 2022 at 14:43

7 Answers 7


BQN, 81 bytesSBCS

•Out 65024↑1042/"#?ZY>Rg*778c0?74h3g)G?mm5963!1[!1OC+VUb)7]#Z-%&N/D^sUrJaVwc}%! "

Try it online! This is written for CBQN, I removed the •Out to run it online.

If you split the binary into chunks of 1042, in each chunk at least one printable different from " is missing. Search program:

pa ← @-˜'"'⊸≠⊸/' '+↕95
b ← @-˜•FBytes "fr08v101.exe"
m ← ⊑⌽1000+/{⊑∧´¬∧˝pa∊⌜<˘↑‿𝕩⥊b}¨ 1000+↕1000
•Show m
•Show @+⊑⟜pa¨ ⊑∘/˘⍉¬pa∊⌜<˘↑‿m⥊b

Pyth, 55 51 bytes


Try it online!

         "iýy±å7˱â7a£Õ§³mh79B!OÈ­wc7wÝ%'÷î3awo÷c­#    41-character string literal
   *L1586                                            repeat each character 1586 times
  s                                                  concatenate
<3                                                   remove the last 3 characters
                                                     output with a trailing newline

(Use the PYTHONIOENCODING=latin1 environment variable for correct binary output.)

  • \$\begingroup\$ I feel like the requirement of the environment variable should cost bytes. \$\endgroup\$
    – Makonede
    Jan 27, 2022 at 19:08
  • \$\begingroup\$ @Makonede The environment variable is not required; it just changes the output format to bytes for more convenient verification. The output without it is still correct, just in a different format (65024 UTF-8 characters), exactly like l4m2’s own JavaScript answer and similarly to the answers that return an array of 65024 integers. \$\endgroup\$ Jan 27, 2022 at 19:43

Charcoal, 339 bytes


Try it online! Link is to verbose version of code. Explanation: Charcoal is very good at printing lots of - signs. The compressed strings represents all the runs of non---signs in the file. Each run of -s is separated by a newline, thus ensuring that no character of the output matches a character in the file.


Turn off Charcoal's default rectangular output, since we don't want space padding.


Split the compressed string 1041\n97...104\n2031 on newlines (they are the golfiest separators), and cast the numbers to integer, which causes Charcoal to output them as that number of - signs.

A "port" of @ovs's answer is only 90 bytes:


Try it online! Link is to verbose version of code. Explanation: Simply repeats each character in the compressed string 512 times (I used this instead of @ovs' 1042 because it's a factor of 65024 and larger factors end up covering all of printable ASCII). Conveniently all the characters needed are in Charcoal's "symbols" area which allows the string to be compressed from 127 to 84 bytes. (It's not possible to do this with all letters (either upper or lower case) or all digits.)


JavaScript (ES10), 131 bytes

Returns an array of bytes.


Try it online!


This encodes 64 bytes \$b_0\$ to \$b_{63}\$ that are repeated 1016 times each and do not appear in the corresponding chunk of the original file:


The values were chosen in such a way that \$|b_k-b_{k-1}|<18\$ for each \$k>0\$, which allows to store the delta values in base 36.


JavaScript (Node.js), 74 bytes SBCS


Try it online!

I'm not sure if this happen for random enough file, or why you use aaaabbbbccccdddd rather than abcdabcdabcdabcd even for languages with better support for the latter solution

  • \$\begingroup\$ I haven't tried the abcdabcd... pattern for my answer, but it only has a longer lookup string because I limited myself to printable ascii. If I'd use the full byte range, I could use a length 41 string, which is shorter than the one used here. I guess in Javascript repeating each character is a lot longer, so your approach is probably better. \$\endgroup\$
    – ovs
    Jan 27, 2022 at 16:14
  • \$\begingroup\$ @ovs Using printable ascii, the minimum loop length is 76 \$\endgroup\$
    – l4m2
    Jan 27, 2022 at 17:28

05AB1E, 260 70 69 bytes

-1 thanks to Kevin Cruijssen.


Try it online! Outputs as a list of byte values. Alternative link for text output.


Similarly to other answers here, this answer uses equal-sized chunks (except the last chunk), each consisting of the same byte throughout the entire chunk (but different bytes throughout the entire output). To get an optimal score, maximizing the chunk size is important – or rather, minimizing the number of chunks.

To do this, I iterated through chunk sizes, starting from \$1{,}000\$ and going up. With each iteration, I checked if every byte value was present at least once in at least one chunk.

This happened at \$1{,}200\$ bytes per chunk. This meant that each chunk but the last can be up to \$1{,}199\$ bytes, with the last chunk being \$278\$ bytes. This means there are \$54\$ full chunks plus the small chunk at the end, making a total of \$55\$ chunks.

Let's verify this: \$54×1{,}199+278=65{,}024\$.

Finally, for each chunk, we find the smallest byte that doesn't exist there and repeat it for the length of that chunk, and we're done!

  • \$\begingroup\$ εŽ4´и} to Ž4´δи for -1. \$\endgroup\$ Jan 27, 2022 at 9:03

PHP (276 chars)

for($d=[-17,-532,-95,-515,-79,463,95,-392,-27,148,$i=-1,808,53,61,15,-665,-5,419,-29,211,46,399,95,569,11,-2,101,-588,11,418,-43,-70,-48,-1887,105,918,-63,-1655,-97,-317,-104,-116,-74,513,53,885,-97,605,150,593,20,-295];++$i<52;)echo str_repeat(chr(150-$d[$i]),2500-$d[++$i]);

Try it Online (using an URL shortener to store the .exe file)

If GMP is available it's 206 chars long :

for($d=str_split(($i=0).gmp_init('1FmB6eDs41MlblmT1hchbcMok3RFjcIJ7OHt8hphdLMPDPgigsPrqHXfc3QEFotYuvL9zfZ3y7ZYkD7nnoSCgAzgJhHEVnl9R6mB5cshIudtpnunsccV',62),4);$i<52;)echo str_repeat(chr($d[$i++]),$d[$i++]);

How is generated this sequence of str_repeat ?

Just by the output of strcspn.

$data = file_get_contents('raw_file');
$file_length = strlen($data);
$ptr = 0;
while ($ptr < $file_length) {
    $max_dist = $max_ord = 0;
    for ($i = 0; $i < 256; ++$i) {
        $char = chr($i);
        $dist = strcspn($data, $char, $ptr);
        if ($dist > $max_dist) {
            $max_dist = $dist;
            $max_ord = $i;
    $ptr += $max_dist;
    echo ".str_repeat(chr($max_ord), $max_dist)";

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.