Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python 3. Need a python code that reads a jpg file, that has a size between 600kbs and 800kbs and places it into a

Using Python 3.

Need a python code that reads a jpg file, that has a size between 600kbs and 800kbs and places it into a large bytearray. A loop then reads a 1021 byte portion of the bytearray and creates a checksum.

Then a function that creates a checksum of the 1021 bytes by reading the first two bytes of the bytearray and performs bitwise addition of these two sets of 16 bits. If there is a carry bit then the function will add the carry to sum and then invert the bits of the sum. If there isn't a carry then the function just inverts the sum. This value is then added to the next sum. The loop repeats this action and add it to the previous sum. This loop much know when it gets to the end of the bytearray. This means that the final checksum will be of less than 1021 bytes. Finally, the checksum will be only two bytes and will represent the entire 1021 byte packet (unless the packet is less than 1021 bytes due to being the last portion of the file. This checksum must be 2 bytes in length because it will be added to a 1-byte sequence number and the 1021 bytes data packet to then be sent over a UDP socket to eventually transfer an entire file.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

Brief the importance of span of control and its concepts.

Answered: 1 week ago

Question

What is meant by decentralisation?

Answered: 1 week ago

Question

What is the orientation toward time?

Answered: 1 week ago

Question

4. How is culture a contested site?

Answered: 1 week ago