Skip to content

Instantly share code, notes, and snippets.

@drproteus
Last active December 20, 2022 18:43
Show Gist options
  • Save drproteus/2dc2cff628cc5d9267d5ba2c7929c39b to your computer and use it in GitHub Desktop.
Save drproteus/2dc2cff628cc5d9267d5ba2c7929c39b to your computer and use it in GitHub Desktop.
#!python
import sys
MOD_ADLER = 65521
def adler32(s):
a, b = 1, 0
for c in s:
a = (a + ord(c)) % MOD_ADLER
b = (b + a) % MOD_ADLER
return hex(b << 16 | a)[2:]
if __name__ == "__main__":
for arg in sys.argv[1:]:
print(adler32(arg))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment