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 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):