Skip to content
DeepForgeby svx
All problems
EasyAlgorithmsal-314

Adler-32 Checksum

Problem

Compute the Adler-32 checksum of a string using modulus 65521: one sum starts at 1, the other at 0, each character code is added to the first sum and the first sum is then added to the second.

Return the second sum shifted left sixteen bits plus the first. The empty string gives 1.

Hint

65521 is the largest prime below 2 to the 16th power.

Test cases

case 1
in: [""]
expected: 1
case 2
in: ["a"]
expected: 6422626
case 3
in: ["Wikipedia"]
expected: 300286872
case 4
in: ["hello"]
expected: 103547413
case 5
in: ["123456789"]
expected: 152961502
Starter codePython
def adler32_checksum(data):
    # Your code here
    pass

5 test cases · run your code against them in the editor