How do you compute sambaLMPassword/sambaNTPassword?

Christopher R. Hertel crh at ubiqx.mn.org
Sun Mar 21 04:19:38 GMT 2004


Florin Jurcovici wrote:
:
> In order to provide single signon and allow for complete user management
> using Lotus/Domino, in combination with Samba, I need to fill in the two
> fields by hand, when doing a password change in Lotus/Domino. So I need to
> know either the exact algorithms used for hashing or where I can find the
> funcs which do the hashing in the Samba code, then I'll be able to rebuild
> the funcs.

How it's done is explained in detail here:
  http://ubiqx.org/cifs/SMB.html#SMB.8

But basically:

- The LM Hash is computed using the DES() algorithm.  The computation is
  fairly simple.  The input is the password, in OEM Charset (8-bit)
encoding,
  converted to upper case.  In most cases that's just the upper-case of an
  ASCII string.

- The NT Hash is just the MD4() of the password.  In this case, however, the
  password must be in Unicode (UCS2LE encoding).

There should be function around to convert the password to the correct
encoding for each hash algorithm.  Andrew pointed out some Samba code that
can create the hashes.  If you need, I can point you at some additional code
that might be more stand-alone and easier to use.

Chris -)-----

-- 
"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team -- http://www.samba.org/     -)-----   Christopher R. Hertel
jCIFS Team -- http://jcifs.samba.org/   -)-----   ubiqx development, uninq.
ubiqx Team -- http://www.ubiqx.org/     -)-----   crh at ubiqx.mn.org
OnLineBook -- http://ubiqx.org/cifs/    -)-----   crh at ubiqx.org


More information about the samba-technical mailing list