jkff/digest — pull request #2 by joeyadams (2012-03-09 06:21:09+00:00)
Title: Handle empty strings properly in crc32Update and adler32Update

Currently, `crc32Update 123 empty` returns 0 instead of 123. Worse, for some empty ByteStrings, it does return the correct value of 123.

This is because zlib's `adler32` and `crc32` return the hash function's initial seed when passed a `NULL` pointer. Some ByteStrings contain null pointers, while others don't. The current implementation of `crc32Update` and `adler32Update` treat these differently, violating referential transparency.

The first commit handles empty strings by returning the given seed. The second commit adds a small test suite.