mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 21:20:25 +00:00
56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
/*
|
|
* Copyright 2004 Hans Leidekker
|
|
*
|
|
* Based on LMHash.c from libcifs
|
|
*
|
|
* Copyright (C) 2004 by Christopher R. Hertel
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*/
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include "windef.h"
|
|
#include "winbase.h"
|
|
#include "winreg.h"
|
|
#include "winternl.h"
|
|
#include "ntstatus.h"
|
|
|
|
#include "crypt.h"
|
|
|
|
static const unsigned char CRYPT_LMhash_Magic[8] =
|
|
{ 'K', 'G', 'S', '!', '@', '#', '$', '%' };
|
|
|
|
static void CRYPT_LMhash( unsigned char *dst, const unsigned char *pwd, const int len )
|
|
{
|
|
int i, max = 14;
|
|
unsigned char tmp_pwd[14] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
|
|
|
|
max = len > max ? max : len;
|
|
|
|
for (i = 0; i < max; i++)
|
|
tmp_pwd[i] = pwd[i];
|
|
|
|
CRYPT_DEShash( dst, tmp_pwd, CRYPT_LMhash_Magic );
|
|
CRYPT_DEShash( &dst[8], &tmp_pwd[7], CRYPT_LMhash_Magic );
|
|
}
|
|
|
|
NTSTATUS WINAPI SystemFunction006( LPCSTR password, LPSTR hash )
|
|
{
|
|
CRYPT_LMhash( (unsigned char*)hash, (unsigned char*)password, strlen(password) );
|
|
|
|
return STATUS_SUCCESS;
|
|
}
|