Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the following code in PYTHON IDLE 3.5. The output should look the same as

ID: 3814936 • Letter: W

Question

Write the following code in PYTHON IDLE 3.5. The output should look the same as below.

Eile Edit Yew Hbtory Bookmarks bols Help SakaieURI:CSC 110 Spri.. X Search https sakai. uriedu/p Most visited Getting started In class this week we developed 8-bit and 16-bit checksum algorithms, each of which had problems when considering them to be used for a digital signature in an investigation, For this homework assignment, you will write a Sample Code python function to implementa checksum algorithm known as Alder-32. The folowing is the description of this algorithm from Wikipedia: Forums An Adler-32 checksum is obtained by calculating two 16-bit checksums A and B and concatenating their bits into a 32-bit integer. A is the sum of all bytes in the stream plus one, and Bis the sum of the individual values of A from each step CSC Links At the beginning of an Adler-32 run, Ais initialized to 1 B to 0, The sums are done modulo 65521 (the largest prime number smaller than 2 6), Schedule The function may be expressed as: Gradebook E A 1 D1 D2 Dn (mod 6552 University Course Policies BE (1 D1) (1 D1 D2) (1 D1 D2 Dn) mod 6552 Adler-320D) B x 65536 -A Site Info Help You can read more about this algorithm and see anexample of how it is computed here: A few notes about the pseudocode above: 1. D1, D2, etc. are the decimal values of the characters in the input string. So, just as we did in the checksum algorithm we did in class, you will have to get the ASCII value of each character and convert it to decimal 2. Bis computed by accumulating the values of A Write a function to compute the Alder-32 checksum for a given string. You can modify the 8-bit checksum algorithm that we developed in class to implement this Alder-32 algorithm. You can find the checksuma.py algorithm on the Sample Code page after class on Tuesday. Your output will look something like this Python 3.5.2 Shel Python 3.5.2 (v3.5.2:4def2a2901aS, Jun 26 2016, 10:47:25) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3DJ on darwin Type copyright credits or license for more information. RESTART: /Users/idipippo/Documents/csc 110/homework/hw7-alder32.p checksumAlderC CHECKSUM') 169935444 checksumAlderC'DIGITALFORENSICS') 657523883 check sumAlderC'EVIDENCE') 173867588

Explanation / Answer

def checksumAlder(s):
   A = 1
   B = 0
   tmp = 1
   for a in s:
       val = ord(a)
       A+=val
       tmp+=val
       B+=tmp
       if(A>65521):
           A = A%65521
       if(B>65521):
           B=B%65521
   return B*65536+A
d = checksumAlder("CHECKSUM")
print(d)
d = checksumAlder('DIGITALFORENSICS')
print(d)
d = checksumAlder('EVIDENCE')
print(d)