Uses PBKDF2-SHA256 instead of plain SHA256

Fixes #192
This commit is contained in:
Manuel Ebert 2014-08-08 13:16:51 +02:00
parent 9c4294ca68
commit 1f73d28147
2 changed files with 5 additions and 2 deletions

View file

@ -1,11 +1,12 @@
import hashlib
from . import Journal, util from . import Journal, util
from cryptography.fernet import Fernet, InvalidToken from cryptography.fernet import Fernet, InvalidToken
import base64 import base64
from passlib.hash import pbkdf2_sha256
def make_key(password): 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): class EncryptedJournal(Journal.Journal):

View file

@ -89,6 +89,8 @@ setup(
"tzlocal>=1.1", "tzlocal>=1.1",
"PyYAML>=3.11", "PyYAML>=3.11",
"keyring>=3.3", "keyring>=3.3",
"passlib>=1.6.2",
"python-dateutil>=2.2"
] + [p for p, cond in conditional_dependencies.items() if cond], ] + [p for p, cond in conditional_dependencies.items() if cond],
long_description=__doc__, long_description=__doc__,
entry_points={ entry_points={