mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
py3: more hashlib fixes
This commit is contained in:
parent
74c3bfa9fe
commit
ddbda87137
@ -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]))
|
||||
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user