.zip files store their index at the end of the file. This means you con concatenate it to many typical files and get a file that will open as two completely different formats. Some other file formats are just .zip files, as mentioned. So, you can combine a .jpg file and a .docx file and get something that will open as an image or a document.
I believe the reason .zip files were originally backwards is so they can be written to a tape in one pass.
I believe the reason .zip files were originally backwards is so they can be written to a tape in one pass.
It's so they can be cheaply appended by the resource constrained computers of the time. Adding a new file is lopping off the index, adding the compressed data, then updating the index and adding it onto the end of the file. No need to rewrite or even read the entire file. You only need to seek backwards from the end and mess with the index.
It's not even a hard requirement to remove the index, a valid Zip file can have a number of them throughout. Only the very last one is used to get the location of all the file offsets.
50
u/throwaway39791 14h ago
.exe files are so funny.
If you open it up in HXD or whatever you like, a lot of them carry this header:
And this is a REALLY old compromise. Some .exe files carry other messages, but this message is a bit of junk since MS DOS.
I highly recommend opening up random file formats in a hex editor. It's a great way to spend an evening. Trust.
16
u/mccoyn 9h ago
.zip files store their index at the end of the file. This means you con concatenate it to many typical files and get a file that will open as two completely different formats. Some other file formats are just .zip files, as mentioned. So, you can combine a .jpg file and a .docx file and get something that will open as an image or a document.
I believe the reason .zip files were originally backwards is so they can be written to a tape in one pass.