1 #ifndef AUTH_LMHASH_H 2 #define AUTH_LMHASH_H 3 4 typedef unsigned char uchar; 5 6 /* ========================================================================== ** 7 * 8 * LMhash.h 9 * 10 * Copyright: 11 * Copyright (C) 2004 by Christopher R. Hertel 12 * 13 * Email: crh@ubiqx.mn.org 14 * 15 * $Id: LMhash.h,v 0.1 2004/05/30 02:26:31 crh Exp $ 16 * 17 * -------------------------------------------------------------------------- ** 18 * 19 * Description: 20 * 21 * Implemention of the LAN Manager hash (LM hash) and LM response 22 * algorithms. 23 * 24 * -------------------------------------------------------------------------- ** 25 * 26 * License: 27 * 28 * This library is free software; you can redistribute it and/or 29 * modify it under the terms of the GNU Lesser General Public 30 * License as published by the Free Software Foundation; either 31 * version 2.1 of the License, or (at your option) any later version. 32 * 33 * This library is distributed in the hope that it will be useful, 34 * but WITHOUT ANY WARRANTY; without even the implied warranty of 35 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 36 * Lesser General Public License for more details. 37 * 38 * You should have received a copy of the GNU Lesser General Public 39 * License along with this library; if not, write to the Free Software 40 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 41 * 42 * -------------------------------------------------------------------------- ** 43 * 44 * Notes: 45 * 46 * This module implements the LM hash. The NT hash is simply the MD4() of 47 * the password, so we don't need a separate implementation of that. This 48 * module also implements the LM response, which can be combined with the 49 * NT hash to produce the NTLM response. 50 * 51 * This implementation was created based on the description in my own book. 52 * The book description was, in turn, written after studying many existing 53 * examples in various documentation. Jeremy Allison and Andrew Tridgell 54 * deserve lots of credit for having figured out the secrets of Lan Manager 55 * authentication many years ago. 56 * 57 * See: 58 * Implementing CIFS - the Common Internet File System 59 * by your truly. ISBN 0-13-047116-X, Prentice Hall PTR., August 2003 60 * Section 15.3, in particular. 61 * (Online at: http://ubiqx.org/cifs/SMB.html#SMB.8.3) 62 * 63 * ========================================================================== ** 64 */ 65 66 /* -------------------------------------------------------------------------- ** 67 * Functions: 68 */ 69 70 uchar *auth_LMhash( uchar *dst, const uchar *pwd, const int pwdlen ); 71 /* ------------------------------------------------------------------------ ** 72 * Generate an LM Hash from the input password. 73 * 74 * Input: dst - Pointer to a location to which to write the LM Hash. 75 * Requires 16 bytes minimum. 76 * pwd - Source password. Should be in OEM charset (extended 77 * ASCII) format in all upper-case, but this 78 * implementation doesn't really care. See the notes 79 * below. 80 * pwdlen - Length, in bytes, of the password. Normally, this 81 * will be strlen( pwd ). 82 * 83 * Output: Pointer to the resulting LM hash (same as <dst>). 84 * 85 * Notes: This function does not convert the input password to upper 86 * case. The upper-case conversion should be done before the 87 * password gets this far. DOS codepage handling and such 88 * should be taken into consideration. Rather than attempt to 89 * work out all those details here, the function assumes that 90 * the password is in the correct form before it reaches this 91 * point. 92 * 93 * ------------------------------------------------------------------------ ** 94 */ 95 #endif 96