The programs below calculate the rsync weak sum (of block size 4096) of the last block of the data available on stdin.
The data is assumed to be at least block size big; the weak sum is calculated in a direct manner for the first block, and from that on, the sum is adjusted on each incoming byte using the "rollability" of this kind of checksum.
The primary goal was to see the performance of naive implementations; so my metrics was both performance and "how close is the code to