import hashlib
def CalcFileSha256(filname):
''' calculate file sha256 '''
with open(filname, "rb") as f:
sha256obj = hashlib.sha256()
sha256obj.update(f.read())
hash_value = sha256obj.hexdigest()
return hash_value
def CalcFileSize(filename):
''' calculate file size '''
"""total size, in bytes"""
return os.stat(filename).st_size
file = "ss.zip"
print(CalcFileSha256(file))
print(CalcFileSize(file))