init package and add first subpackages

This commit is contained in:
Markus Clauß
2023-02-27 17:07:04 +01:00
commit 1b4ce18eca
16 changed files with 1658 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
import hashlib
from io import BytesIO
def calc_hash_of_bytes(buf: BytesIO):
""" calculate the hash of the file """
algo = hashlib.sha1()
buffer_size = 65536
buffer_size = buffer_size * 1024 * 1024
while True:
data = buf.read(buffer_size)
if not data:
break
algo.update(data)
hex = algo.hexdigest()
return hex