How do you compute sambaLMPassword/sambaNTPassword?

Christopher R. Hertel crh at
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:

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)
  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 --     -)-----   Christopher R. Hertel
jCIFS Team --   -)-----   ubiqx development, uninq.
ubiqx Team --     -)-----   crh at
OnLineBook --    -)-----   crh at

More information about the samba-technical mailing list