Test sha sum parameter type properly

This commit is contained in:
shortcutme 2019-03-16 02:38:38 +01:00
parent 5c0fc38272
commit f7fd445c73
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -26,9 +26,8 @@ def sha512sum(file, blocksize=65536, format="hexdigest"):
return hash.digest()[0:32]
def sha256sum(file, blocksize=65536):
if hasattr(file, "endswith"): # Its a string open it
if type(file) is str: # Filename specified
file = open(file, "rb")
hash = hashlib.sha256()
for block in iter(lambda: file.read(blocksize), b""):