Reputation: 81
I have seen answers for this but didn't get the right way to do it. Our package has been created in .tar format by some other team. How can i get the checksum of the contents of the files in tar ball using Python? People have suggested to create md5 file while archiving but that is not the way we do. Can anybody suggest something on this? Thanks in advance.
Upvotes: 0
Views: 2176
Reputation: 7475
The tar
format does not contain any file integrity information on the file contents themselves. The format only contains a checksum of each header block, which contains the file metadata, but that doesn't guarantee the integrity of the file contents.
You can read Basic Tar Format for more about the format, and here for a brief note about data corruption in tar files.
The only way to ensure the integrity of the files themselves is to calculate a checksum or hash on the files in the archive, or on the tarball itself, at the time of archiving, as you said people already suggested to you.
Upvotes: 1