mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-07-07 00:36:13 +02:00
Python 3 fixes :)
This commit is contained in:
parent
b7d8e1a9a5
commit
94964dc31c
3 changed files with 11 additions and 6 deletions
|
@ -9,13 +9,12 @@ import base64
|
|||
|
||||
|
||||
def make_key(password):
|
||||
if type(password) is unicode:
|
||||
password = password.encode('utf-8')
|
||||
password = util.bytes(password)
|
||||
kdf = PBKDF2HMAC(
|
||||
algorithm=hashes.SHA256(),
|
||||
length=32,
|
||||
# Salt is hard-coded
|
||||
salt='\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8',
|
||||
salt=b'\xf2\xd5q\x0e\xc1\x8d.\xde\xdc\x8e6t\x89\x04\xce\xf8',
|
||||
iterations=100000,
|
||||
backend=default_backend()
|
||||
)
|
||||
|
@ -34,7 +33,7 @@ class EncryptedJournal(Journal.Journal):
|
|||
and otherwise ask the user to enter a password up to three times.
|
||||
If the password is provided but wrong (or corrupt), this will simply
|
||||
return None."""
|
||||
with open(filename) as f:
|
||||
with open(filename, 'rb') as f:
|
||||
journal_encrypted = f.read()
|
||||
|
||||
def validate_password(password):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue