diff options
Diffstat (limited to 'src/leap/soledad')
-rw-r--r-- | src/leap/soledad/client/_scrypt.py | 4 |
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 |