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)
| 152 | |
| 153 | |
| 154 | def 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 | |
| 165 | def weakchecksum(data): |