Skip to content

Commit fd287ea

Browse files
authored
Add files via upload
1 parent 191c9e6 commit fd287ea

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

pyfoxfile.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3765,13 +3765,13 @@ def GetHeaderChecksum(inlist=None, checksumtype="md5", encodedata=True, formatsp
37653765
hdr_bytes = _to_bytes(hdr_bytes)
37663766
hdr_bytes = bytes(hdr_bytes)
37673767
saltkeyval = None
3768-
if(saltkey is not None and os.path.exists(saltkey
3768+
if(saltkey is not None and os.path.exists(saltkey)):
37693769
skfp = open(saltkey, "rb")
37703770
saltkeyval = skfp.read()
37713771
skfp.close()
37723772
else:
37733773
saltkey = None
3774-
if(saltkeyval is None)::
3774+
if(saltkeyval is None):
37753775
saltkey = None
37763776
if CheckSumSupport(algo_key, hashlib_guaranteed):
37773777
if(saltkey is None or saltkeyval is None):
@@ -3791,13 +3791,13 @@ def GetFileChecksum(inbytes, checksumtype="md5", encodedata=True, formatspecs=__
37913791
"""
37923792
algo_key = (checksumtype or "md5").lower()
37933793
saltkeyval = None
3794-
if(saltkey is not None and os.path.exists(saltkey
3794+
if(saltkey is not None and os.path.exists(saltkey)):
37953795
skfp = open(saltkey, "rb")
37963796
saltkeyval = skfp.read()
37973797
skfp.close()
37983798
else:
37993799
saltkey = None
3800-
if(saltkeyval is None)::
3800+
if(saltkeyval is None):
38013801
saltkey = None
38023802
# file-like streaming
38033803
if hasattr(inbytes, "read"):
@@ -4848,7 +4848,7 @@ def ReadFileDataWithContent(fp, filestart=0, listonly=False, uncompress=True, sk
48484848
fp, formatspecs['format_delimiter'])
48494849
fprechecksumtype = inheader[-2]
48504850
fprechecksum = inheader[-1]
4851-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
4851+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
48524852
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
48534853
if(not headercheck and not skipchecksum):
48544854
VerbosePrintOut(
@@ -5041,7 +5041,7 @@ def ReadFileDataWithContentToArray(fp, filestart=0, seekstart=0, seekend=0, list
50415041
return False
50425042
fprechecksumtype = inheader[-2]
50435043
fprechecksum = inheader[-1]
5044-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
5044+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
50455045
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
50465046
if(not headercheck and not skipchecksum):
50475047
VerbosePrintOut(
@@ -5224,7 +5224,7 @@ def ReadFileDataWithContentToList(fp, filestart=0, seekstart=0, seekend=0, listo
52245224
return False
52255225
fprechecksumtype = inheader[-2]
52265226
fprechecksum = inheader[-1]
5227-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
5227+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
52285228
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
52295229
if(not headercheck and not skipchecksum):
52305230
VerbosePrintOut(
@@ -5841,7 +5841,7 @@ def MakeEmptyFile(outfile, fmttype="auto", compression="auto", compresswholefile
58415841
fp = CompressOpenFile(outfile, compresswholefile, compressionlevel)
58425842
except PermissionError:
58435843
return False
5844-
AppendFileHeader(fp, 0, "UTF-8", ['hello', 'goodbye'], {}, checksumtype, formatspecs)
5844+
AppendFileHeader(fp, 0, "UTF-8", ['hello', 'goodbye'], {}, checksumtype, formatspecs, saltkey)
58455845
if(outfile == "-" or outfile is None or hasattr(outfile, "read") or hasattr(outfile, "write")):
58465846
fp = CompressOpenFileAlt(
58475847
fp, compression, compressionlevel, compressionuselist, formatspecs)
@@ -6004,7 +6004,7 @@ def AppendFilesWithContent(infiles, fp, dirlistfromtxt=False, extradata=[], json
60046004
inodetoforminode = {}
60056005
numfiles = int(len(GetDirList))
60066006
fnumfiles = format(numfiles, 'x').lower()
6007-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6007+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
60086008
try:
60096009
fp.flush()
60106010
if(hasattr(os, "sync")):
@@ -6345,7 +6345,7 @@ def AppendFilesWithContentFromTarFile(infile, fp, extradata=[], jsondata={}, com
63456345
except FileNotFoundError:
63466346
return False
63476347
numfiles = int(len(tarfp.getmembers()))
6348-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6348+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
63496349
try:
63506350
fp.flush()
63516351
if(hasattr(os, "sync")):
@@ -6545,7 +6545,7 @@ def AppendFilesWithContentFromZipFile(infile, fp, extradata=[], jsondata={}, com
65456545
if(ziptest):
65466546
VerbosePrintOut("Bad file found!")
65476547
numfiles = int(len(zipfp.infolist()))
6548-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6548+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
65496549
try:
65506550
fp.flush()
65516551
if(hasattr(os, "sync")):
@@ -6752,7 +6752,7 @@ def AppendFilesWithContentFromRarFile(infile, fp, extradata=[], jsondata={}, com
67526752
if(rartest):
67536753
VerbosePrintOut("Bad file found!")
67546754
numfiles = int(len(rarfp.infolist()))
6755-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6755+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
67566756
try:
67576757
fp.flush()
67586758
if(hasattr(os, "sync")):
@@ -6994,7 +6994,7 @@ def AppendFilesWithContentFromSevenZipFile(infile, fp, extradata=[], jsondata={}
69946994
if(sztestalt):
69956995
VerbosePrintOut("Bad file found!")
69966996
numfiles = int(len(szpfp.list()))
6997-
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs)
6997+
AppendFileHeader(fp, numfiles, "UTF-8", [], {}, [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
69986998
try:
69996999
fp.flush()
70007000
if(hasattr(os, "sync")):
@@ -7163,7 +7163,7 @@ def AppendListsWithContent(inlist, fp, dirlistfromtxt=False, extradata=[], jsond
71637163
inodetoforminode = {}
71647164
numfiles = int(len(GetDirList))
71657165
fnumfiles = format(numfiles, 'x').lower()
7166-
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs)
7166+
AppendFileHeader(fp, numfiles, "UTF-8", [], [checksumtype[0], checksumtype[1]], formatspecs, saltkey)
71677167
for curfname in GetDirList:
71687168
ftype = format(curfname[0], 'x').lower()
71697169
fencoding = curfname[1]
@@ -9765,7 +9765,7 @@ def FoxFileValidate(infile, fmttype="auto", filestart=0, formatspecs=__file_form
97659765
else:
97669766
return False
97679767
il = 0
9768-
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs)
9768+
headercheck = ValidateHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, fprechecksum, formatspecs, saltkey)
97699769
newfcs = GetHeaderChecksum([formstring] + inheader[:-1], fprechecksumtype, True, formatspecs, saltkey)
97709770
valid_archive = True
97719771
invalid_archive = False
@@ -10324,7 +10324,7 @@ def RePackFoxFile(infile, outfile, fmttype="auto", compression="auto", compressw
1032410324
if lenlist != fnumfiles:
1032510325
fnumfiles = lenlist
1032610326

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

1032910329
# loop counters
1033010330
lcfi = 0

0 commit comments

Comments
 (0)