Skip to content

Commit 18cd3af

Browse files
authored
Add files via upload
1 parent 07d86a6 commit 18cd3af

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

pyarchivefile.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3757,13 +3757,13 @@ def GetHeaderChecksum(inlist=None, checksumtype="md5", encodedata=True, formatsp
37573757
hdr_bytes = _to_bytes(hdr_bytes)
37583758
hdr_bytes = bytes(hdr_bytes)
37593759
saltkeyval = None
3760-
if(saltkey is not None and os.path.exists(saltkey
3760+
if(saltkey is not None and os.path.exists(saltkey)):
37613761
skfp = open(saltkey, "rb")
37623762
saltkeyval = skfp.read()
37633763
skfp.close()
37643764
else:
37653765
saltkey = None
3766-
if(saltkeyval is None)::
3766+
if(saltkeyval is None):
37673767
saltkey = None
37683768
if CheckSumSupport(algo_key, hashlib_guaranteed):
37693769
if(saltkey is None or saltkeyval is None):
@@ -3783,13 +3783,13 @@ def GetFileChecksum(inbytes, checksumtype="md5", encodedata=True, formatspecs=__
37833783
"""
37843784
algo_key = (checksumtype or "md5").lower()
37853785
saltkeyval = None
3786-
if(saltkey is not None and os.path.exists(saltkey
3786+
if(saltkey is not None and os.path.exists(saltkey)):
37873787
skfp = open(saltkey, "rb")
37883788
saltkeyval = skfp.read()
37893789
skfp.close()
37903790
else:
37913791
saltkey = None
3792-
if(saltkeyval is None)::
3792+
if(saltkeyval is None):
37933793
saltkey = None
37943794
# file-like streaming
37953795
if hasattr(inbytes, "read"):
@@ -4840,7 +4840,7 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
48404840
fp, formatspecs['format_delimiter'])
48414841
fprechecksumtype = inheader[-2]
48424842
fprechecksum = inheader[-1]
4843-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
4843+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
48444844
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
48454845
if(not headercheck and not skipchecksum):
48464846
VerbosePrintOut(
@@ -5033,7 +5033,7 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
50335033
return False
50345034
fprechecksumtype = inheader[-2]
50355035
fprechecksum = inheader[-1]
5036-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
5036+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
50375037
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
50385038
if(not headercheck and not skipchecksum):
50395039
VerbosePrintOut(
@@ -5216,7 +5216,7 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
52165216
return False
52175217
fprechecksumtype = inheader[-2]
52185218
fprechecksum = inheader[-1]
5219-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
5219+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
52205220
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
52215221
if(not headercheck and not skipchecksum):
52225222
VerbosePrintOut(
@@ -5833,7 +5833,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
58335833
fp = CompressOpenFile(outfile, compresswholefile, compressionlevel)
58345834
except PermissionError:
58355835
return False
5836-
AppendFileHeader(fp, 0, "UTF-8", ['hello', 'goodbye'], {}, checksumtype, formatspecs)
5836+
AppendFileHeader(fp, 0, "UTF-8", ['hello', 'goodbye'], {}, checksumtype, formatspecs, saltkey)
58375837
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
58385838
fp = CompressOpenFileAlt(
58395839
fp, compression, compressionlevel, compressionuselist, formatspecs)
@@ -5996,7 +5996,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
59965996
inodetoforminode = {}
59975997
numfiles = int(len(GetDirList))
59985998
fnumfiles = format(numfiles, 'x').lower()
5999-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
5999+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
60006000
try:
60016001
fp.flush()
60026002
if(hasattr(os, "sync")):
@@ -6337,7 +6337,7 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
63376337
except FileNotFoundError:
63386338
return False
63396339
numfiles = int(len(tarfp.getmembers()))
6340-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6340+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
63416341
try:
63426342
fp.flush()
63436343
if(hasattr(os, "sync")):
@@ -6537,7 +6537,7 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
65376537
if(ziptest):
65386538
VerbosePrintOut("Bad file found!")
65396539
numfiles = int(len(zipfp.infolist()))
6540-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6540+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
65416541
try:
65426542
fp.flush()
65436543
if(hasattr(os, "sync")):
@@ -6744,7 +6744,7 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
67446744
if(rartest):
67456745
VerbosePrintOut("Bad file found!")
67466746
numfiles = int(len(rarfp.infolist()))
6747-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6747+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
67486748
try:
67496749
fp.flush()
67506750
if(hasattr(os, "sync")):
@@ -6986,7 +6986,7 @@ def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}
69866986
if(sztestalt):
69876987
VerbosePrintOut("Bad file found!")
69886988
numfiles = int(len(szpfp.list()))
6989-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6989+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
69906990
try:
69916991
fp.flush()
69926992
if(hasattr(os, "sync")):
@@ -7155,7 +7155,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsond
71557155
inodetoforminode = {}
71567156
numfiles = int(len(GetDirList))
71577157
fnumfiles = format(numfiles, 'x').lower()
7158-
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs)
7158+
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
71597159
for curfname in GetDirList:
71607160
ftype = format(curfname[0], 'x').lower()
71617161
fencoding = curfname[1]
@@ -9757,7 +9757,7 @@ def ArchiveFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_
97579757
else:
97589758
return False
97599759
il = 0
9760-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
9760+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
97619761
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
97629762
valid_archive = True
97639763
invalid_archive = False
@@ -10316,7 +10316,7 @@ def RePackArchiveFile(infile, outfile, fmttype="auto", compression="auto", compr
1031610316
if lenlist != fnumfiles:
1031710317
fnumfiles = lenlist
1031810318

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

1032110321
# loop counters
1032210322
lcfi = 0

0 commit comments

Comments
 (0)