Browse Source

Added debug helper.

pull/18/head
Simon Eisenmann 12 years ago
parent
commit
aee0175479
  1. 26
      doc/file-sharing-issue/splitToCrc.py

26
doc/file-sharing-issue/splitToCrc.py

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
#!/usr/bin/python
# Simple helper to split files into chunks and generate crc32
# checksums to help with file sharing debugging.
import sys
import zlib
fileChunkSize = 60000
def main(fn):
print "Splitting %s ..." % fn
count = 0
with open(fn, "rb") as f:
while True:
chunk = f.read(fileChunkSize)
count += 1
print count, zlib.crc32(chunk) & 0xffffffff
if len(chunk) < fileChunkSize:
break
if __name__ == "__main__":
args = sys.argv[1:]
if not args:
print "Usage %s: filename" % sys.argv[0]
main(args[0])
Loading…
Cancel
Save