MCPcopy Create free account
hub / github.com/ActiveState/code / rollingchecksum

Function rollingchecksum

recipes/Python/577518_Rsync_Algorithm/recipe-577518.py:154–162  ·  view source on GitHub ↗

Generates a new weak checksum when supplied with the internal state of the checksum calculation for the previous window, the removed byte, and the added byte.

(removed, new, a, b, blocksize=4096)

Source from the content-addressed store, hash-verified

152
153
154def rollingchecksum(removed, new, a, b, blocksize=4096):
155 """
156 Generates a new weak checksum when supplied with the internal state
157 of the checksum calculation for the previous window, the removed
158 byte, and the added byte.
159 """
160 a -= removed - new
161 b -= removed * blocksize - a
162 return (b << 16) | a, a, b
163
164
165def weakchecksum(data):

Callers 1

rsyncdeltaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected