passlib.hash.mssql2000 - MS SQL 2000 password hash

Danger

This algorithm is not considered secure by modern standards. It should only be used when verifying existing hashes, or when interacting with applications that require this format. For new code, see the list of recommended hashes.

New in version 1.6.

This class implements the hash algorithm used by Microsoft SQL Server 2000 to store its user account passwords, until it was replaced by a slightly more secure variant (mssql2005) in MSSQL 2005. This class can be used directly as follows:

>>> from passlib.hash import mssql2000 as m20

>>> # hash password
>>> h = m20.hash("password")
>>> h
'0x0100200420C4988140FD3920894C3EDC188E94F428D57DAD5905F6CC1CBAF950CAD4C63F272B2C91E4DEEB5E6444'

>>> # verify correct password
>>> m20.verify("password", h)
True
>>> m20.verify("letmein", h)
False

See also

Interface

class passlib.hash.mssql2000

This class implements the password hash used by MS-SQL 2000, and follows the PasswordHash API.

It supports a fixed-length salt.

The using() method accepts the following optional keywords:

Parameters:
  • salt (bytes) – Optional salt string. If not specified, one will be autogenerated (this is recommended). If specified, it must be 4 bytes in length.
  • relaxed (bool) – By default, providing an invalid value for one of the other keywords will result in a ValueError. If relaxed=True, and the error can be corrected, a PasslibHashWarning will be issued instead. Correctable errors include salt strings that are too long.

Security Issues

This algorithm is reasonably weak, and shouldn’t be used for any purpose besides manipulating existing MSSQL 2000 hashes, due to the following flaws:

  • The fact that it is case insensitive greatly reduces the keyspace that must be searched by brute-force or pre-computed attacks.
  • Its simplicity, and years of research on high-speed SHA1 implementations, makes efficient brute force attacks much more feasible.

Footnotes

[1]Overview hash algorithms used by MSSQL - https://blogs.msdn.com/b/lcris/archive/2007/04/30/sql-server-2005-about-login-password-hashes.aspx?Redirected=true.
[2]Description of MSSQL 2000 algorithm - http://www.theregister.co.uk/2002/07/08/cracking_ms_sql_server_passwords/.