/* --- SECURITY.CPP --- / / Written by Phil Himsworth, 2001-2002. / /*/ #include #include #include #include "types.h" #include "main.h" #include "html.h" #include "plugin.h" extern char password[], username[]; extern int securepassword; extern winampGeneralPurposePlugin plugin; // Base64 character array // 0 1 2 3 4 5 6 // 01234567890123456789012345678901234567890123456789012345678901234 char bchars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+*"; char achars[256]; // -------------------------------------------------------------------------------- // Calculates MD5 of a string bool MD5(char * input, char * output, int output_len) { //MessageBox(NULL,input,"MD5 input",MB_TOPMOST | MB_OK); HCRYPTPROV hProv = 0; HCRYPTHASH Hash; if(!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); // Process any inserts in lpMsgBuf. // ... // Display the string. MessageBox( NULL, (LPCTSTR)lpMsgBuf, "MD5 AcquireContext Error", MB_OK | MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); return false; } CryptCreateHash(hProv,CALG_MD5, 0, 0, &Hash); int input_len = lstrlen(input); BYTE md5raw[2048]; int md5raw_len = 2048; CryptHashData(Hash,(unsigned char*)input,input_len, 0); // md5 of "