Format scatterhash.py

This commit is contained in:
TKE
2020-12-18 10:06:10 +01:00
parent 175e780248
commit c32e4bf314

View File

@@ -17,7 +17,6 @@ def even_select(N, M):
q, r = divmod(N, M) q, r = divmod(N, M)
indices = [q*i + min(i, r) for i in range(M)] indices = [q*i + min(i, r) for i in range(M)]
cut[indices] = False cut[indices] = False
return cut return cut
def get_offsets(blocksize, blockcount,blocks_to_hash): def get_offsets(blocksize, blockcount,blocks_to_hash):
@@ -27,7 +26,6 @@ def get_offsets(blocksize, blockcount,blocks_to_hash):
offset = int(blocksize*i) offset = int(blocksize*i)
yield offset yield offset
def get_hash(file,hashalgo,spread): def get_hash(file,hashalgo,spread):
h=hashlib.new(hashalgo) h=hashlib.new(hashalgo)
filesize = os.path.getsize(file.name) filesize = os.path.getsize(file.name)
@@ -40,7 +38,6 @@ def get_hash(file,hashalgo,spread):
h.update(file.read(blocksize)) h.update(file.read(blocksize))
else: else:
h.update(file.read(blocksize)) h.update(file.read(blocksize))
result="{};{};{};{};{}".format(h.hexdigest(),spread,filesize,hashalgo,file.name) result="{};{};{};{};{}".format(h.hexdigest(),spread,filesize,hashalgo,file.name)
return result return result