summaryrefslogtreecommitdiff
path: root/src/leap/soledad/client/_scrypt.py
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2017-07-18 12:06:25 -0400
committerKali Kaneko <kali@leap.se>2017-07-18 12:06:25 -0400
commitb5e1a45b3c85eca52c116b595f58a6eec5d9664a (patch)
tree4ccdc3385b0fe8138f1ea99fb109eaeea0bc41ae /src/leap/soledad/client/_scrypt.py
parent4fd64892c777a30816c24bf2926ba210b442c86b (diff)
[style] pep8
Diffstat (limited to 'src/leap/soledad/client/_scrypt.py')
-rw-r--r--src/leap/soledad/client/_scrypt.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/leap/soledad/client/_scrypt.py b/src/leap/soledad/client/_scrypt.py
index 674fabd7..c55c9e8f 100644
--- a/src/leap/soledad/client/_scrypt.py
+++ b/src/leap/soledad/client/_scrypt.py
@@ -24,10 +24,12 @@ try:
except ImportError:
OPENSSL_HAS_SCRYPT = False
+
def _fallback_hash(secret, salt, buflen=32):
import scrypt
return scrypt.hash(secret, salt, buflen=buflen)
+
if OPENSSL_HAS_SCRYPT:
from cryptography.hazmat.primitives.kdf.scrypt import Scrypt
@@ -35,7 +37,7 @@ if OPENSSL_HAS_SCRYPT:
try:
_hash = Scrypt(
salt, buflen, 16384, 8, 1, backend).derive(secret)
- except UnsupportedAlgorithm:
+ except UnsupportedAlgorithm:
_hash = _fallback_hash(secret, salt, buflen)
return _hash