sentry.hashers.ldap – sentry.hashers.ldap module reference

LDAP-compatible password hashers

class sentry.hashers.ldap.LDAPClearHasher

Bases: sentry.hashers.BaseHasher

>>> h = LDAPClearHasher()
>>> h("hello", "hello")
True
>>> h("hello", "world")
False
>>> h("world", "world")
True
hsh(clear)
class sentry.hashers.ldap.LDAPCryptHasher

Bases: sentry.hashers.BaseHasher

>>> h = LDAPCryptHasher()
>>> h("{CRYPT}1GmAXTdQYrcNM", "hello")
True
>>> h("{CRYPT}xsuUIXqcz71Vg", "hello")
False
>>> h("{CRYPT}xsuUIXqcz71Vg", "world")
True
hsh(clear, salt)
class sentry.hashers.ldap.LDAPHasher

Bases: sentry.hashers.BaseHasher Picks an appropriate LDAP hasher based on the password.

>>> h = LDAPHasher()
>>> h("{SSHA}CuT4gt9tHkar0jWopoPHAnxBC04UuQ8J", "hello")
True
>>> h("{SHA}qvTGHdzF6KLavt4PO0gs2a6pQ00=", "hello")
True
>>> h("{SMD5}mHt0zAE/iohp3JWCqvSdkE6TCYg=", "hello")
True
>>> h("{MD5}XUFAKrxLKna5cZ2REBfFkg==", "hello")
True
>>> h("{CRYPT}zPXL4mJy7IrrM", "hello")
True
>>> h("hello", "hello")
True
class sentry.hashers.ldap.LDAPMD5Hasher

Bases: sentry.hashers.BaseHasher

>>> h = LDAPMD5Hasher()
>>> h("{MD5}XUFAKrxLKna5cZ2REBfFkg==", "hello")
True
>>> h("{MD5}fXkwN6B2AYZXSwKC8vQ15w==", "hello")
False
>>> h("{MD5}fXkwN6B2AYZXSwKC8vQ15w==", "world")
True
hsh(clear)
>>> h = LDAPMD5Hasher()
>>> h.hsh("hello")
'{MD5}XUFAKrxLKna5cZ2REBfFkg=='
class sentry.hashers.ldap.LDAPSHAHasher

Bases: sentry.hashers.BaseHasher

>>> h = LDAPSHAHasher()
>>> h("{SHA}qvTGHdzF6KLavt4PO0gs2a6pQ00=", "hello")
True
>>> h("{SHA}fCEUM/AgcVl3Qeb/Wo6jR4mrv0M=", "hello")
False
>>> h("{SHA}fCEUM/AgcVl3Qeb/Wo6jR4mrv0M=", "world")
True
hsh(clear)
>>> h = LDAPSHAHasher()
>>> h.hsh("hello")
'{SHA}qvTGHdzF6KLavt4PO0gs2a6pQ00='
class sentry.hashers.ldap.LDAPSMD5Hasher

Bases: sentry.hashers.BaseHasher

>>> h = LDAPSMD5Hasher()
>>> h("{SMD5}mHt0zAE/iohp3JWCqvSdkE6TCYg=", "hello")
True
>>> h("{SMD5}mBgarfiNeDNrwAiHEgCukdR/p8g=", "hello")
False
>>> h("{SMD5}mBgarfiNeDNrwAiHEgCukdR/p8g=", "world")
True
hsh(clear, salt)
>>> h = LDAPSMD5Hasher()
>>> h.hsh("hello", 'N\x93\t\x88')
'{SMD5}mHt0zAE/iohp3JWCqvSdkE6TCYg='
class sentry.hashers.ldap.LDAPSSHAHasher

Bases: sentry.hashers.BaseHasher

>>> h = LDAPSSHAHasher()
>>> h("{SSHA}CuT4gt9tHkar0jWopoPHAnxBC04UuQ8J", "hello")
True
>>> h("{SSHA}alezzDJHy5Hwyz/v0W4IPIFjAQZ90B1d", "hello")
False
hsh(clear, salt)
>>> h = LDAPSSHAHasher()
>>> h.hsh("hello", '#2\xa1I')
'{SSHA}pbe18/fKwd1PjtQMMkiSErcSpLQjMqFJ'