diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index f7e88f4ba5..4c4c21c5d3 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -15,7 +15,7 @@ from calibre.constants import DEBUG from calibre.devices.kindle.bookmark import Bookmark from calibre.devices.usbms.driver import USBMS from calibre import strftime, fsync, prints -from polyglot.builtins import unicode_type +from polyglot.builtins import unicode_type, as_bytes ''' Notes on collections: @@ -433,7 +433,7 @@ class KINDLE2(KINDLE): if path_map: for book in bl: path = '/mnt/us/'+book.lpath - h = hashlib.sha1(path).hexdigest() + h = hashlib.sha1(as_bytes(path)).hexdigest() if h in path_map: book.device_collections = list(sorted(path_map[h])) diff --git a/src/calibre/devices/smart_device_app/driver.py b/src/calibre/devices/smart_device_app/driver.py index 532aac5d8b..177787d5b8 100644 --- a/src/calibre/devices/smart_device_app/driver.py +++ b/src/calibre/devices/smart_device_app/driver.py @@ -1027,7 +1027,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin): password = self.settings().extra_customization[self.OPT_PASSWORD] if password: challenge = isoformat(now()) - hasher = hashlib.new('sha1') + hasher = hashlib.sha1() hasher.update(password.encode('UTF-8')) hasher.update(challenge.encode('UTF-8')) hash_digest = hasher.hexdigest()