diff --git a/ox/net.py b/ox/net.py index 200a2b4..3d4c52e 100644 --- a/ox/net.py +++ b/ox/net.py @@ -145,8 +145,9 @@ def oshash(url): if filesize > 65536: tail = get_range(url, filesize-65536, filesize) if filesize < 65536: - for offset in range(0, filesize, bytesize): - buffer = head[offset:offset+bytesize] + f = BytesIO(head) + for x in range(int(filesize/bytesize)): + buffer = f.read(bytesize) (l_value,)= struct.unpack(longlongformat, buffer) hash += l_value hash = hash & 0xFFFFFFFFFFFFFFFF #cut off 64bit overflow