Skip to content
DeepForgeby svx
All problems
MediumAlgorithmsal-333

CRC32 Checksum

Problem

Compute the standard CRC-32 checksum of a string using the reflected polynomial 0xEDB88320, without any library.

Start from all ones, XOR each character code into the register, shift it right eight times flipping bits with the polynomial on every odd register, and invert the final value. The empty string has checksum 0.

Hint

The check string 123456789 produces the well-known CRC-32 value 0xCBF43926.

Test cases

case 1
in: [""]
expected: 0
case 2
in: ["a"]
expected: 3904355907
case 3
in: ["hello"]
expected: 907060870
case 4
in: ["123456789"]
expected: 3421780262
case 5
in: ["The quick brown fox"]
expected: 3074782430
Starter codePython
def crc32_checksum(data):
    # Your code here
    pass

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