diff options
author | Eli Collins <elic@assurancetechnologies.com> | 2016-06-10 12:32:52 -0400 |
---|---|---|
committer | Eli Collins <elic@assurancetechnologies.com> | 2016-06-10 12:32:52 -0400 |
commit | 281dacd121d72c7570442a13f2113f63c6c439ba (patch) | |
tree | 997fcabde572da2fc5c8158243e26cce64ee3874 /passlib/handlers/mssql.py | |
parent | 61dc39910c6904c69f2e81d5dd41090cac1f18a1 (diff) | |
download | passlib-281dacd121d72c7570442a13f2113f63c6c439ba.tar.gz |
.encrypt() method renamed to .hash(), other api cleanups
.encrypt()
----------
hash.encrypt() & context.encrypt() have been renamed to .hash().
this should take care of the long-standing issue 21 (the poor naming of .encrypt).
per docs, legacy aliases will remain in place until passlib 2.0.
.genhash() / .genconfig()
-------------------------
taking advantage of this reorganization to also deprecate .genconfig()
and .genhash() -- they're not really useful in a modern system,
nor as needed for historical support as initially thought:
.genconfig() will be retired completely in passlib 2.0;
.genhash() is rolled into the new .hash() method along with .encrypt().
Diffstat (limited to 'passlib/handlers/mssql.py')
-rw-r--r-- | passlib/handlers/mssql.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/passlib/handlers/mssql.py b/passlib/handlers/mssql.py index 21d7133..5366618 100644 --- a/passlib/handlers/mssql.py +++ b/passlib/handlers/mssql.py @@ -104,7 +104,7 @@ class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): It supports a fixed-length salt. - The :meth:`~passlib.ifc.PasswordHash.encrypt` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept the following optional keywords: + The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept the following optional keywords: :type salt: bytes :param salt: @@ -127,7 +127,6 @@ class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): setting_kwds = ("salt",) checksum_size = 40 min_salt_size = max_salt_size = 4 - _stub_checksum = b"\x00" * 40 #=================================================================== # formatting @@ -150,7 +149,7 @@ class mssql2000(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): return cls(salt=data[:4], checksum=data[4:]) def to_string(self): - raw = self.salt + (self.checksum or self._stub_checksum) + raw = self.salt + self.checksum # raw bytes format - BIDENT2 + raw return "0x0100" + bascii_to_str(hexlify(raw).upper()) @@ -182,7 +181,7 @@ class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): It supports a fixed-length salt. - The :meth:`~passlib.ifc.PasswordHash.encrypt` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept the following optional keywords: + The :meth:`~passlib.ifc.PasswordHash.hash` and :meth:`~passlib.ifc.PasswordHash.genconfig` methods accept the following optional keywords: :type salt: bytes :param salt: @@ -206,7 +205,6 @@ class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): checksum_size = 20 min_salt_size = max_salt_size = 4 - _stub_checksum = b"\x00" * 20 #=================================================================== # formatting @@ -228,7 +226,7 @@ class mssql2005(uh.HasRawSalt, uh.HasRawChecksum, uh.GenericHandler): return cls(salt=data[:4], checksum=data[4:]) def to_string(self): - raw = self.salt + (self.checksum or self._stub_checksum) + raw = self.salt + self.checksum # raw bytes format - BIDENT2 + raw return "0x0100" + bascii_to_str(hexlify(raw)).upper() |