mirror of
https://github.com/Leseratte10/acsm-calibre-plugin.git
synced 2024-12-22 17:29:56 +06:00
More Python2 cleanup
This commit is contained in:
parent
3a460ae1fd
commit
171c6f36ba
@ -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:
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user