Test sha sum parameter type properly
This commit is contained in:
parent
5c0fc38272
commit
f7fd445c73
1 changed files with 1 additions and 2 deletions
|
@ -26,9 +26,8 @@ def sha512sum(file, blocksize=65536, format="hexdigest"):
|
||||||
return hash.digest()[0:32]
|
return hash.digest()[0:32]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def sha256sum(file, blocksize=65536):
|
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")
|
file = open(file, "rb")
|
||||||
hash = hashlib.sha256()
|
hash = hashlib.sha256()
|
||||||
for block in iter(lambda: file.read(blocksize), b""):
|
for block in iter(lambda: file.read(blocksize), b""):
|
||||||
|
|
Loading…
Reference in a new issue