Skip to content

Commit d43b18d

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

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

pycatfile.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,13 +3764,13 @@ 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 and os.path.exists(saltkey
3767+
if(saltkey is not None and os.path.exists(saltkey)):
37683768
skfp = open(saltkey, "rb")
37693769
saltkeyval = skfp.read()
37703770
skfp.close()
37713771
else:
37723772
saltkey = None
3773-
if(saltkeyval is None)::
3773+
if(saltkeyval is None):
37743774
saltkey = None
37753775
if CheckSumSupport(algo_key, hashlib_guaranteed):
37763776
if(saltkey is None or saltkeyval is None):
@@ -3790,13 +3790,13 @@ def GetFileChecksum(inbytes, checksumtype="md5", encodedata=True, formatspecs=__
37903790
"""
37913791
algo_key = (checksumtype or "md5").lower()
37923792
saltkeyval = None
3793-
if(saltkey is not None and os.path.exists(saltkey
3793+
if(saltkey is not None and os.path.exists(saltkey)):
37943794
skfp = open(saltkey, "rb")
37953795
saltkeyval = skfp.read()
37963796
skfp.close()
37973797
else:
37983798
saltkey = None
3799-
if(saltkeyval is None)::
3799+
if(saltkeyval is None):
38003800
saltkey = None
38013801
# file-like streaming
38023802
if hasattr(inbytes, "read"):
@@ -4847,7 +4847,7 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
48474847
fp, formatspecs['format_delimiter'])
48484848
fprechecksumtype = inheader[-2]
48494849
fprechecksum = inheader[-1]
4850-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
4850+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
48514851
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
48524852
if(not headercheck and not skipchecksum):
48534853
VerbosePrintOut(
@@ -5040,7 +5040,7 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
50405040
return False
50415041
fprechecksumtype = inheader[-2]
50425042
fprechecksum = inheader[-1]
5043-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
5043+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
50445044
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
50455045
if(not headercheck and not skipchecksum):
50465046
VerbosePrintOut(
@@ -5223,7 +5223,7 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
52235223
return False
52245224
fprechecksumtype = inheader[-2]
52255225
fprechecksum = inheader[-1]
5226-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
5226+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
52275227
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
52285228
if(not headercheck and not skipchecksum):
52295229
VerbosePrintOut(
@@ -5840,7 +5840,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
58405840
fp = CompressOpenFile(outfile, compresswholefile, compressionlevel)
58415841
except PermissionError:
58425842
return False
5843-
AppendFileHeader(fp, 0, "UTF-8", ['hello', 'goodbye'], {}, checksumtype, formatspecs)
5843+
AppendFileHeader(fp, 0, "UTF-8", ['hello', 'goodbye'], {}, checksumtype, formatspecs, saltkey)
58445844
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
58455845
fp = CompressOpenFileAlt(
58465846
fp, compression, compressionlevel, compressionuselist, formatspecs)
@@ -6003,7 +6003,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
60036003
inodetoforminode = {}
60046004
numfiles = int(len(GetDirList))
60056005
fnumfiles = format(numfiles, 'x').lower()
6006-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6006+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
60076007
try:
60086008
fp.flush()
60096009
if(hasattr(os, "sync")):
@@ -6344,7 +6344,7 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
63446344
except FileNotFoundError:
63456345
return False
63466346
numfiles = int(len(tarfp.getmembers()))
6347-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6347+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
63486348
try:
63496349
fp.flush()
63506350
if(hasattr(os, "sync")):
@@ -6544,7 +6544,7 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
65446544
if(ziptest):
65456545
VerbosePrintOut("Bad file found!")
65466546
numfiles = int(len(zipfp.infolist()))
6547-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6547+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
65486548
try:
65496549
fp.flush()
65506550
if(hasattr(os, "sync")):
@@ -6751,7 +6751,7 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
67516751
if(rartest):
67526752
VerbosePrintOut("Bad file found!")
67536753
numfiles = int(len(rarfp.infolist()))
6754-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6754+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
67556755
try:
67566756
fp.flush()
67576757
if(hasattr(os, "sync")):
@@ -6993,7 +6993,7 @@ def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}
69936993
if(sztestalt):
69946994
VerbosePrintOut("Bad file found!")
69956995
numfiles = int(len(szpfp.list()))
6996-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6996+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
69976997
try:
69986998
fp.flush()
69996999
if(hasattr(os, "sync")):
@@ -7162,7 +7162,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsond
71627162
inodetoforminode = {}
71637163
numfiles = int(len(GetDirList))
71647164
fnumfiles = format(numfiles, 'x').lower()
7165-
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs)
7165+
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
71667166
for curfname in GetDirList:
71677167
ftype = format(curfname[0], 'x').lower()
71687168
fencoding = curfname[1]
@@ -9764,7 +9764,7 @@ def CatFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_form
97649764
else:
97659765
return False
97669766
il = 0
9767-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
9767+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
97689768
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
97699769
valid_archive = True
97709770
invalid_archive = False
@@ -10323,7 +10323,7 @@ def RePackCatFile(infile, outfile, fmttype="auto", compression="auto", compressw
1032310323
if lenlist != fnumfiles:
1032410324
fnumfiles = lenlist
1032510325

10326-
AppendFileHeader(fp, fnumfiles, listarrayfiles.get('fencoding', 'utf-8'), listarrayfiles['fextradata'], listarrayfiles['fjsondata'], [checksumtype[0], checksumtype[1]], formatspecs)
10326+
AppendFileHeader(fp, fnumfiles, listarrayfiles.get('fencoding', 'utf-8'), listarrayfiles['fextradata'], listarrayfiles['fjsondata'], [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
1032710327

1032810328
# loop counters
1032910329
lcfi = 0

0 commit comments

Comments
 (0)