diff --git a/calibre-plugin/__init__.py b/calibre-plugin/__init__.py index 1046331..400fdc3 100644 --- a/calibre-plugin/__init__.py +++ b/calibre-plugin/__init__.py @@ -37,7 +37,8 @@ # Ignore fatal HTTP errors and/or a missing or broken server during optional # fulfillment notifications, allow authorizing an eReader through USB (experimental), # drop dependencies python-cryptography, python-rsa and python-pyasn1. -# add a ton of testing code, try to prevent AV false-positives. +# add a ton of testing code, try to prevent AV false-positives, +# experimental support for Python2 / Calibre < 5. PLUGIN_NAME = "DeACSM" PLUGIN_VERSION_TUPLE = (0, 0, 15) @@ -70,10 +71,9 @@ class DeACSM(FileTypePlugin): def initialize(self): """ - On initialization, make sure we have all the libraries (python-rsa, cryptography, - oscrypto and their dependencies asn1crypto and pyasn1) that the plugin needs. - Unfortunately the Adobe encryption is kinda weird and nonstandard and doesn't work - with just the python modules included with Calibre. + On initialization, make sure we have all the libraries (oscrypto and its dependency + asn1crypto) that the plugin needs. Unfortunately the Adobe encryption is kinda weird + and nonstandard and doesn't work with just the python modules included with Calibre. """ try: diff --git a/calibre-plugin/libadobe.py b/calibre-plugin/libadobe.py index 55c156e..0e5dc39 100644 --- a/calibre-plugin/libadobe.py +++ b/calibre-plugin/libadobe.py @@ -198,16 +198,10 @@ def makeSerial(random): mac_address = get_mac_address() - if sys.version_info[0] >= 3: - dataToHash = "%d:%s:%02x:%02x:%02x:%02x:%02x:%02x\x00" % (uid, username, - mac_address[0], mac_address[1], mac_address[2], - mac_address[3], mac_address[4], mac_address[5]) + dataToHash = "%d:%s:%02x:%02x:%02x:%02x:%02x:%02x\x00" % (uid, username, + mac_address[0], mac_address[1], mac_address[2], + mac_address[3], mac_address[4], mac_address[5]) - else: - dataToHash = "%d:%s:%02x:%02x:%02x:%02x:%02x:%02x\x00" % (uid, username, - mac_address[0], mac_address[1], mac_address[2], - mac_address[3], mac_address[4], mac_address[5]) - sha_out = hashlib.sha1(dataToHash.encode('latin-1')).hexdigest().lower() else: import binascii