Generates a weak checksum from an iterable set of bytes.
(data)
| 163 | |
| 164 | |
| 165 | def weakchecksum(data): |
| 166 | """ |
| 167 | Generates a weak checksum from an iterable set of bytes. |
| 168 | """ |
| 169 | a = b = 0 |
| 170 | l = len(data) |
| 171 | for i in range(l): |
| 172 | a += data[i] |
| 173 | b += (l - i)*data[i] |
| 174 | |
| 175 | return (b << 16) | a, a, b |
no test coverage detected