Add back unpad to fix Python2 support

This commit is contained in:
NoDRM
2022-03-19 10:14:45 +01:00
parent cf095a4171
commit b283777c0a
10 changed files with 109 additions and 29 deletions

View File

@@ -166,7 +166,7 @@
from __future__ import print_function
__version__ = '10.0.1'
__about__ = "Obok v{0}\nCopyright © 2012-2020 Physisticated et al.".format(__version__)
__about__ = "Obok v{0}\nCopyright © 2012-2022 Physisticated et al.".format(__version__)
import sys
import os
@@ -185,10 +185,17 @@ import tempfile
try:
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import unpad
except ImportError:
from Crypto.Cipher import AES
from Crypto.Util.Padding import unpad
def unpad(data, padding=16):
if sys.version_info[0] == 2:
pad_len = ord(data[-1])
else:
pad_len = data[-1]
return data[:-pad_len]
can_parse_xml = True
try: