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, 2019 in Python by ana1504.k
• 7,910 points
3,261 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, 2019 by SDeb
• 13,300 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, 2019 in Python by Arvind
• 3,050 points
927 views
0 votes
1 answer

I have trained a model using machine learning algorithm in python , now i want to create a browser extension of that saved model , Is it possible ??

Hi@Shubham, It may possible. When you saved your ML ...READ MORE

answered Jun 13, 2020 in Python by MD
• 95,460 points
1,146 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, 2019 in Python by Nymeria
• 3,560 points
1,799 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
• 58,020 points
3,737 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,300 points
1,003 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
• 58,020 points
785 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,300 points
965 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,300 points
868 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP