Skip to content

Commit 7afaca6

Browse files
authored
Add files via upload
1 parent b3ce242 commit 7afaca6

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

pycatfile.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,10 +3764,14 @@ def GetHeaderChecksum(inlist=None, checksumtype="md5", encodedata=True, formatsp
37643764
hdr_bytes = _to_bytes(hdr_bytes)
37653765
hdr_bytes = bytes(hdr_bytes)
37663766
saltkeyval = None
3767-
if(saltkey is not None):
3767+
if(saltkey is not None and os.path.exists(saltkey
37683768
skfp = open(saltkey, "rb")
37693769
saltkeyval = skfp.read()
37703770
skfp.close()
3771+
else:
3772+
saltkey = None
3773+
if(saltkeyval is None)::
3774+
saltkey = None
37713775
if CheckSumSupport(algo_key, hashlib_guaranteed):
37723776
if(saltkey is None or saltkeyval is None):
37733777
h = hashlib.new(algo_key, hdr_bytes)
@@ -3786,10 +3790,14 @@ def GetFileChecksum(inbytes, checksumtype="md5", encodedata=True, formatspecs=__
37863790
"""
37873791
algo_key = (checksumtype or "md5").lower()
37883792
saltkeyval = None
3789-
if(saltkey is not None):
3793+
if(saltkey is not None and os.path.exists(saltkey
37903794
skfp = open(saltkey, "rb")
37913795
saltkeyval = skfp.read()
37923796
skfp.close()
3797+
else:
3798+
saltkey = None
3799+
if(saltkeyval is None)::
3800+
saltkey = None
37933801
# file-like streaming
37943802
if hasattr(inbytes, "read"):
37953803
# hashlib

0 commit comments

Comments
 (0)