Is it enough to only create checksum of a zip package instead of each file?

0 votes
How do I check the authenticity of a zip package downloaded. Is it enough to only create the checksum of the zip package and check it in local? Do i need to create the checksum of each file included?

    m = hashlib.md5()  
    file = io.FileIO('test.zip','r')  
    bytes = file.read(1024)  
    while(bytes != b''):  
        m.update(bytes)  
        bytes = file.read(1024)   
    file.close()
May 8 in Python by ana1504.k
• 7,870 points
17 views

1 answer to this question.

0 votes
I assume you are asking about the scope of the MD5 hash, not the checksum. Because ZIP is a lossless compression algorithm, taking the hash of the whole ZIP archive (and checking it against the expected value) should provide identical "authenticity" information as checking the hash of each uncompressed internal file individually. If the ZIP archive hash matches the expected value, you don't even need to worry about the checksum values. The hash is a far more robust mechanism than the checksum.
answered May 8 by SDeb
• 13,160 points

Related Questions In Python

0 votes
1 answer

is it possible to create zip of a directory in Python?

Please go through this code. This should ...READ MORE

answered Jul 10 in Python by Arvind
• 2,960 points
21 views
0 votes
1 answer

How to zip with a list output in Python instead of a tuple output?

Good question - Considering that you are ...READ MORE

answered Feb 7 in Python by Nymeria
• 3,520 points
43 views
0 votes
1 answer

Is it possible to create a dictionary with multiple keys for a single value?

One thing that you can do here ...READ MORE

answered Jul 24 in Python by Arvind
• 2,960 points
24 views
0 votes
1 answer

Section postgresql not found in the database.ini file

Python doesn't know what $FILEDIR is. Try an absolute path ...READ MORE

answered Oct 3, 2018 in Python by Priyaj
• 56,520 points
157 views
0 votes
1 answer

Iterating over dictionaries using 'for' loops

key is just a variable name. for key ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,160 points
50 views
0 votes
1 answer

Conflicting dependencies of pypyodbc and blpapi

I figured out that pypyodbc only works ...READ MORE

answered Oct 9, 2018 in Python by Priyaj
• 56,520 points
84 views
0 votes
1 answer

Is arr.__len__() the preferred way to get the length of an array in Python?

my_list = [1,2,3,4,5,6,7] len(my_list) # 7 The same works for ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,160 points
58 views
0 votes
1 answer

How to download a file over HTTP using Python?

In Python 2, use urllib2 which comes ...READ MORE

answered Oct 18, 2018 in Python by SDeb
• 13,160 points
48 views