Change messages about config file to registry.
[wine/multimedia.git] / dlls / advapi32 / crypt_lmhash.c
blob15f689d1dcb5566ee4515abcc1bf94b411899864
1 /*
2 * Copyright 2004 Hans Leidekker
4 * Based on LMHash.c from libcifs
6 * Copyright (C) 2004 by Christopher R. Hertel
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include <stdarg.h>
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winreg.h"
28 #include "winternl.h"
29 #include "ntstatus.h"
31 #include "crypt.h"
33 static const unsigned char CRYPT_LMhash_Magic[8] =
34 { 'K', 'G', 'S', '!', '@', '#', '$', '%' };
36 static void CRYPT_LMhash( unsigned char *dst, const unsigned char *pwd, const int len )
38 int i, max = 14;
39 unsigned char tmp_pwd[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
41 max = len > max ? max : len;
43 for (i = 0; i < max; i++)
44 tmp_pwd[i] = pwd[i];
46 CRYPT_DEShash( dst, tmp_pwd, CRYPT_LMhash_Magic );
47 CRYPT_DEShash( &dst[8], &tmp_pwd[7], CRYPT_LMhash_Magic );
50 NTSTATUS WINAPI SystemFunction006( LPCSTR password, LPSTR hash )
52 CRYPT_LMhash( hash, password, strlen(password) );
54 return STATUS_SUCCESS;