When I zip (Zip 2.31) the same file in Linux I get a different checksum everytime. How can I keep the same md5sum from last time? I'm using the latest zip update from yum
MD5 Checksum is used to verify the integrity of files, as virtually any change to a file will cause its MD5 hash to change. Most commonly, md5sum is used to verify that a file has not changed as a result of a faulty file transfer, a disk error or non-malicious modification.
Type the following command: md5sum [type file name with extension here] [path of the file] -- NOTE: You can also drag the file to the terminal window instead of typing the full path. Hit the Enter key. You'll see the MD5 sum of the file. Match it against the original value.
If one character is modified or deleted from the data contained in a file, its MD5 hash code will be completely different than the original MD5 hash code. If a file is defensibly collected and processed, its hash code will not change--even if the file name has been modified.
The archive being generated does not only contain the compressed file data, but also "extra file attributes" (as refered in zip
documentation), as file timestamps, file attributes, ...
If this metadata is different between compressions, you will never get the same checksum, as the metadata for the compresed file has changed and has been included in the archive.
You can use zip
's -X
option (or the long --no-extra
option) to avoid including the files extra attributes in the archive:
zip -X foo.zip foo-file
Sucessive runs of this command without file modifications must not change the hash of the archive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With