summaryrefslogtreecommitdiff
path: root/passlib/handlers/fshp.py
diff options
context:
space:
mode:
Diffstat (limited to 'passlib/handlers/fshp.py')
-rw-r--r--passlib/handlers/fshp.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/passlib/handlers/fshp.py b/passlib/handlers/fshp.py
index 3404bd8..28be83c 100644
--- a/passlib/handlers/fshp.py
+++ b/passlib/handlers/fshp.py
@@ -68,7 +68,9 @@ class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
max_salt_size = None
#--HasRounds--
- default_rounds = 16384 #current passlib default, FSHP uses 4096
+ # FIXME: should probably use different default rounds
+ # based on the variant. setting for default variant (sha256) for now.
+ default_rounds = 50000 #current passlib default, FSHP uses 4096
min_rounds = 1 #set by FSHP
max_rounds = 4294967295 # 32-bit integer limit - not set by FSHP
rounds_cost = "linear"
@@ -116,7 +118,7 @@ class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
if not isinstance(variant, int):
raise TypeError("fshp variant must be int or known alias")
if variant not in self._variant_info:
- raise TypeError("unknown fshp variant")
+ raise ValueError("invalid fshp variant")
return variant
@property
@@ -152,7 +154,7 @@ class fshp(uh.HasRounds, uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler):
rounds = int(rounds)
try:
data = b64decode(data.encode("ascii"))
- except ValueError:
+ except TypeError:
raise uh.exc.MalformedHashError(cls)
salt = data[:salt_size]
chk = data[salt_size:]