100% File Compression

Friday, September 21, 2007

Can you imagine compressing a file by 100%, i.e. compacting a file to 0 bytes? Sounds too astonishing. Well, don't be stupefied when you read that its possible to compress any file to 0 bytes.

BARF! or Better Archiver with Recursive Functionality can achieve a file compression of 100% by recursively compressing the file. The BARF compressor will compress any nonempty file by at least one byte. Thus, by compressing already compressed files over and over again, it is possible to eventually reduce any file to 0 bytes.

BARF is free, open source software, released under the GNU GPL. Its code is written in C/C++ and can be downloaded from the BARF webpage.

How it Works?
BARF uses recursive compression to compress the file. BARF compresses the files by using one of the 257 compression algorithms by selecting the best one at each stage of recursion. At each step it adds an extension .x or .x?? to the existing filename. This technique ensures that there is no disambiguation while decompressing the files.


I know most of you would like to try this out. But, some of you won't understand the technical jargon on the BARF webpage. So, here are the steps to try out file compression with BARF!

Steps for an Amateur:

  1. Download the barf.exe(1 MB approx.) file and copy it to C:\Windows\System32.
  2. Open the Command Prompt (Start>Run and type 'cmd').
  3. To compress a file, type: barf c <filename>
    To compress multiple files: barf c <filename1> <filename2> ...
    To compress all files in the current directory: dir/b | barf c
  4. Repeat the above compression step repeatedly until the file is compressed to 0 bytes or any other desired size. Make sure to append the filename with the extension(.x or .x??) at each step.
  5. To decompress a file, type: barf d <filename>.x
    To decompress multiple files: barf d <filename1>.x <filename2>.x ...
    To decompress all files in the current directory: dir/b | barf d
  6. Repeat the decompression step until the original file is created. Make sure to remove one level of extension(.x or .x??) at each step.
Note: Replace <filename> with the complete name of the file with its path and extension.

7 comments:

Filipe Freitas said...

sounds fishy to me
are you sure it isn't deleting the file (thus achieving 0bytes) instead of compressing? =P

Gurpreet said...

hey, i tried BARF before posting on my blog... its really working...

i compressed a couple of files to 0bytes n then decompressed them to reveal the actual contents...

though the process is a bit time-consuming but u can restrict to a desired level of compression...

Anonymous said...

can you post a video of how this works or a more detailed tutorial because i did what you said and nothing happened

Anonymous said...

It just fools you...make a text file with only letter repeated many times. For Example a file with "hhhhh" when you compress it you will see that the extension which it adds keep repeating basically it removes one letter from the file and adds it to the name. Duh!

Gurpreet said...

it does not fools you. the extensions are added according to the algorithm used for compression at that stage. its not that the text of the file is added as extension.

read the details about the compression technique to know more about the process...

Atul said...

Filesize decreases by a byte and filename increases by 4 bytes. Means, you endup in spending extra 3 bytes. Gain? minus three bytes.



Simply, it stores file data in the filename!



If you want to see the fun, try renaming filename of compressed file and now decompress. You'll realise, it either cannot decompress or produces wrong uncompressed data. Thats trick.

Anonymous said...

this is not working. One byte compressed and two bytes increased filename. O_O

Post a Comment