Skip to content

Instantly share code, notes, and snippets.

@jed
Created July 21, 2012 05:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jed/3154648 to your computer and use it in GitHub Desktop.
Save jed/3154648 to your computer and use it in GitHub Desktop.
non-obfuscated adler32
function adler32(string) {
var length = string.length
, modulus = 65521
, index = 0
, a = 1
, b = 0
while (index < length) {
a += string.charCodeAt(index++)
a %= modulus
b += a
b %= modulus
}
return b << 16 | a
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment