# Path: ldaptor/md4.py
# def md4(data=''):
#     return MD4Type(data)
# 
# Path: ldaptor/config.py
# class MissingBaseDNError(Exception):
# class LDAPConfig(object):
#     def __str__(self):
#     def __init__(self,
#                  baseDN=None,
#                  serviceLocationOverrides=None,
#                  identityBaseDN=None,
#                  identitySearch=None):
#     def getBaseDN(self):
#     def getServiceLocationOverrides(self):
#     def _loadServiceLocationOverrides(self):
#     def copy(self, **kw):
#     def getIdentityBaseDN(self):
#     def getIdentitySearch(self, name):
# def loadConfig(configFiles=None,
#                reload=False):
# def useLMhash():
# DEFAULTS = {
#     'samba': { 'use-lmhash': 'no',
#                },
#     }
# CONFIG_FILES = [
#     '/etc/ldaptor/global.cfg',
#     os.path.expanduser('~/.ldaptor/global.cfg'),
#     ]


import string, warnings
from ldaptor import md4, config
    from Crypto.Cipher import DES

def nthash(password=''):
    """Generates nt md4 password hash for a given password."""

    password=password[:128]
    password=''.join([c+'\000' for c in password])
    return md4.new(password).hexdigest().translate(toupper);

def lmhash_locked(password=''):
    """
    Generates a lanman password hash that matches no password.

    Note that the author thinks LanMan hashes should be banished from
    the face of the earth.
    """
    return 32*'X'

def _no_lmhash(password=''):
    if config.useLMhash():
        warnings.warn("Cannot import Crypto.Cipher.DES, lmhash passwords disabled.")
    return lmhash_locked()

def _have_lmhash(password=''):
    """
    Generates lanman password hash for a given password.

    Note that the author thinks LanMan hashes should be banished from
    the face of the earth.
    """


# Path: ldaptor/md4.py
# def md4(data=''):
#     return MD4Type(data)
# 
# Path: ldaptor/config.py
# class MissingBaseDNError(Exception):
# class LDAPConfig(object):
#     def __str__(self):
#     def __init__(self,
#                  baseDN=None,
#                  serviceLocationOverrides=None,
#                  identityBaseDN=None,
#                  identitySearch=None):
#     def getBaseDN(self):
#     def getServiceLocationOverrides(self):
#     def _loadServiceLocationOverrides(self):
#     def copy(self, **kw):
#     def getIdentityBaseDN(self):
#     def getIdentitySearch(self, name):
# def loadConfig(configFiles=None,
#                reload=False):
# def useLMhash():
# DEFAULTS = {
#     'samba': { 'use-lmhash': 'no',
#                },
#     }
# CONFIG_FILES = [
#     '/etc/ldaptor/global.cfg',
#     os.path.expanduser('~/.ldaptor/global.cfg'),
#     ]


# Path: ldaptor/samba/smbpassword.py
import string, warnings
from ldaptor import md4, config
    from Crypto.Cipher import DES


def nthash(password=''):
    """Generates nt md4 password hash for a given password."""

    password=password[:128]
    password=''.join([c+'\000' for c in password])
    return md4.new(password).hexdigest().translate(toupper);

def lmhash_locked(password=''):
    """
    Generates a lanman password hash that matches no password.

    Note that the author thinks LanMan hashes should be banished from
    the face of the earth.
    """
    return 32*'X'

def _no_lmhash(password=''):
    if config.useLMhash():
        warnings.warn("Cannot import Crypto.Cipher.DES, lmhash passwords disabled.")
    return lmhash_locked()

def _have_lmhash(password=''):
    """
    Generates lanman password hash for a given password.

    Note that the author thinks LanMan hashes should be banished from
    the face of the earth.
    """


    if not config.useLMhash():