adler32 is a checksum algorithm which was invented by mark adler in 1995 compared to a cyclic redundancy check of the same length it trades reliability for speed preferring the latter adler32 is more reliable than fletcher16 and slightly less reliable than fletcher32 2 source https en wikipedia orgwikiadler32 function implements adler32 hash iterates and evaluates a new value for each character adler32 algorithms 363791387 adler32 go adler em all 708642122 function implements adler 32 hash iterates and evaluates a new value for each character adler32 algorithms 363791387 adler32 go adler em all 708642122
MOD_ADLER = 65521


def adler32(plain_text: str) -> int:
    
    a = 1
    b = 0
    for plain_chr in plain_text:
        a = (a + ord(plain_chr)) % MOD_ADLER
        b = (b + a) % MOD_ADLER
    return (b << 16) | a