diff --git a/jrnl/EncryptedJournal.py b/jrnl/EncryptedJournal.py index 2a7092d2..4d9ce944 100644 --- a/jrnl/EncryptedJournal.py +++ b/jrnl/EncryptedJournal.py @@ -1,11 +1,12 @@ -import hashlib from . import Journal, util from cryptography.fernet import Fernet, InvalidToken import base64 +from passlib.hash import pbkdf2_sha256 def make_key(password): - return base64.urlsafe_b64encode(hashlib.sha256(password.encode("utf-8")).digest()) + derived_key = pbkdf2_sha256.encrypt(password.encode("utf-8"), rounds=10000, salt_size=16) + return base64.urlsafe_b64encode(derived_key) class EncryptedJournal(Journal.Journal): diff --git a/setup.py b/setup.py index 03c8ce71..be653be1 100644 --- a/setup.py +++ b/setup.py @@ -89,6 +89,8 @@ setup( "tzlocal>=1.1", "PyYAML>=3.11", "keyring>=3.3", + "passlib>=1.6.2", + "python-dateutil>=2.2" ] + [p for p, cond in conditional_dependencies.items() if cond], long_description=__doc__, entry_points={