summaryrefslogtreecommitdiff
path: root/passlib/context.py
diff options
context:
space:
mode:
authorEli Collins <elic@assurancetechnologies.com>2011-01-19 05:11:48 +0000
committerEli Collins <elic@assurancetechnologies.com>2011-01-19 05:11:48 +0000
commitfd47a3c90c0960d11f16c9ad808ec3f543fed01e (patch)
tree1ddfe97d6c009c17a745cf0cefa24960875cecb9 /passlib/context.py
parent7790935a93c8d86629d65e205af4e45d6ef59897 (diff)
downloadpasslib-fd47a3c90c0960d11f16c9ad808ec3f543fed01e.tar.gz
bugfixin'
========= * bumped to 1.3 * refactored UTs a little bit * updated UTs to match new layout & protocols * lots of bug fixes * all UTs pass
Diffstat (limited to 'passlib/context.py')
-rw-r--r--passlib/context.py15
1 files changed, 4 insertions, 11 deletions
diff --git a/passlib/context.py b/passlib/context.py
index 293f1f9..48ec817 100644
--- a/passlib/context.py
+++ b/passlib/context.py
@@ -13,6 +13,7 @@ import os
#site
#libs
from passlib.utils import abstract_class_method, Undef
+from passlib.handler import get_crypt_handler, is_crypt_handler
#pkg
#local
__all__ = [
@@ -153,17 +154,12 @@ class CryptContext(object):
raise ValueError, "hash could not be identified"
return None
- def encrypt(self, secret, hash=None, alg=None, **kwds):
+ def encrypt(self, secret, alg=None, **kwds):
"""encrypt secret, returning resulting hash.
:arg secret:
String containing the secret to encrypt
- :arg hash:
- Optional hash string previously returned by encrypt (or compatible source).
- If specified, this string will be used to provide default
- value for the salt, rounds, or other algorithm-specific options.
-
:param alg:
Optionally specify the name of the algorithm to use.
If no algorithm is specified, an attempt is made
@@ -179,11 +175,8 @@ class CryptContext(object):
"""
if not self:
raise ValueError, "no algorithms registered"
- if alg or not hash:
- handler = self.lookup(alg, required=True)
- else:
- handler = self.identify(hash, required=True)
- return handler.encrypt(secret, hash, **kwds)
+ handler = self.lookup(alg, required=True)
+ return handler.encrypt(secret, **kwds)
def verify(self, secret, hash, alg=None, **kwds):
"""verify secret against specified hash