Add files via upload

This commit is contained in:
Bluzume 2021-11-02 00:52:32 +13:00 committed by GitHub
parent 3cedcc27c0
commit 03caf07794
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -192,23 +192,24 @@ def DecryptFile(input_filename):
cipher = AES.new(key, AES.MODE_CBC, iv)
original_iv = cipher.decrypt(enc)
md5 = hashlib.md5()
total_file_data = b""
for i in range(0, total_blocks):
file_block = GetBlock(fd, i)
md5.update(file_block)
total_file_data += file_block
fd.close()
total_file_data = total_file_data[:file_size] # trim to file_size
md5 = hashlib.md5()
md5.update(total_file_data)
got_md5 = md5.digest()
if file_md5 != got_md5: # Verify decrypted file.
print("MD5 Mismatch, Expected: "+binascii.hexlify(file_md5).decode("UTF-8")+" got: "+binascii.hexlify(got_md5).decode("UTF-8"))
exit()
exit();
return total_file_data
@ -284,4 +285,4 @@ for psse_file in file_list:
open(psse_list, "wb").write(file_data)
print("Done")
print("Done")