Format scatterhash.py
This commit is contained in:
@@ -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
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user