diff --git a/pyetesync/crypto.py b/pyetesync/crypto.py
index <HASH>..<HASH> 100644
--- a/pyetesync/crypto.py
+++ b/pyetesync/crypto.py
@@ -1,6 +1,7 @@
 import pyaes
 import hashlib
 import hmac
+import pyscrypt
 
 CURRENT_VERSION = 2
 
@@ -12,6 +13,15 @@ def hmac256(key, data):
     return hmac.new(key, data, digestmod=hashlib.sha256).digest()
 
 
+def derive_key(user_password, salt):
+    return pyscrypt.hash(password=user_password.encode('utf-8'),
+                         salt=salt.encode('utf-8'),
+                         N=16384,
+                         r=8,
+                         p=1,
+                         dkLen=190)
+
+
 class CryptoManager:
     def __init__(self, version, key, salt):
         if version > CURRENT_VERSION:
Add a function to derive the key from the user password.