Created
July 21, 2012 05:03
-
-
Save jed/3154648 to your computer and use it in GitHub Desktop.
non-obfuscated adler32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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