Returns a list of weak and strong hashes for each block of the defined size for the given data stream.
(instream, blocksize=4096)
| 121 | |
| 122 | |
| 123 | def blockchecksums(instream, blocksize=4096): |
| 124 | """ |
| 125 | Returns a list of weak and strong hashes for each block of the |
| 126 | defined size for the given data stream. |
| 127 | """ |
| 128 | weakhashes = list() |
| 129 | stronghashes = list() |
| 130 | read = instream.read(blocksize) |
| 131 | |
| 132 | while read: |
| 133 | weakhashes.append(weakchecksum(bytes(read))[0]) |
| 134 | stronghashes.append(hashlib.md5(read).hexdigest()) |
| 135 | read = instream.read(blocksize) |
| 136 | |
| 137 | return weakhashes, stronghashes |
| 138 | |
| 139 | |
| 140 | def patchstream(instream, outstream, delta): |