Home » Questions » Computers [ Ask a new question ]

Why are there binary differences among compressed files generated exactly the same way from the exact same starting file?

Why are there binary differences among compressed files generated exactly the same way from the exact same starting file?

I use the "diff" command to compare two compressed files generated using zip on the exact same starting file and they are reported as being different. However, when I uncompress them and use the "diff" command, no differences are shown. I've noticed this with both zip and gzip.

Asked by: Guest | Views: 46
Total answers/comments: 2
Guest [Entry]

You might also like to use zdiff if you do want to compare the compressed contents.
Guest [Entry]

"You can use the gzip option --no-name (or -n) to stop gzip from adding the original file name and the time stamp to the gzip header. That should prevent mismatches when the data is the same, assuming the same compression level is used. One way to add this option to gzip commands is to set the GZIP environment variable, so that that option is used up by every gzip command. For example, in a Bourne-compatible shell such as bash,

export GZIP=""--no-name -6""

or

export GZIP=--no-name"