履行诺言,相关贴子:
http://bbs.pediy.com/showthread.php?t=44989
http://bbs.pediy.com/showthread.php?t=44950
说明:FHD是我自己写的一个128位散列函数,不想让你太懒惰,其它你自己分析。
//==================================================
/*------------------------------------------------------------*/
/*本CrackMe_0041采用了RC4, FHD, RC6 */
/*作者:HappyTown */
/*日期:2007-05-19 */
/*Name:happy */
/*Team:pediy */
/*SN :0B4713F8B1A9C71A9A9D15F89E3BCF98 */
/*------------------------------------------------------------*/
/*------------------------------------------------------------*/
/* RC4(FHD(name), Team) ?= RC6_decrypt("好好学习...", sn) */
/*------------------------------------------------------------*/
////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <windows.h>
#include "resource.h"
#include "music.c"
#include "str2hex.c"
#include "fhd.c"
#include "rc4.c"
#include "rc6.c"
#pragma comment(lib, "winmm.lib")
#pragma comment(lib, "minifmod.lib")
//#define KG
#define MAXINPUTLEN 500
FMUSIC_MODULE *mod=NULL;
HINSTANCE hInst;
BOOL CALLBACK MainDlg(HWND, UINT, WPARAM, LPARAM);
BOOL Check( HWND) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow)
{
hInst=hInstance;
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_MAINDLG), NULL, (DLGPROC)MainDlg,0);
return 0;
}
BOOL CALLBACK MainDlg(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_CLOSE:
EndDialog(hDlg,0);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON_CHECK:
SetFocus (GetDlgItem(hDlg,IDC_EDIT_SERIAL));
if(Check(hDlg))
{
MessageBoxA (NULL, TEXT ("Good job, man!"), TEXT ("Congratulations"), MB_OK | MB_ICONINFORMATION) ;
}
break;
case IDCANCEL:
PostQuitMessage(0);
}
break;
case WM_INITDIALOG:
SendMessage(hDlg,WM_SETICON,(WPARAM) 1,(LPARAM) LoadIconA(hInst,MAKEINTRESOURCE(IDI_ICON))); // 显示图标
loadmusic();
mod = FMUSIC_LoadSong(NULL, NULL);
if(mod) FMUSIC_PlaySong(mod);
break;
}
return 0;
}
BOOL Check(HWND hWnd)
{
int iNameLen, iTeamLen, iSNLen;
unsigned char szName[MAXINPUTLEN] = {0};
unsigned char szTeam[MAXINPUTLEN] = {0};
unsigned char szSerial[MAXINPUTLEN] = {0};
unsigned char szTemp[MAXINPUTLEN] = {0};
unsigned char Hash[16] = {0};
unsigned char rc6Key[] = "好好学习天天向上";
FHD_CTX fhd_ctx;
RC4_KEY rc4_key;
//取得3个输入框的内容
iNameLen = GetDlgItemText(hWnd, IDC_EDIT_NAME, szName, sizeof(szName)/sizeof(TCHAR)+1);
iTeamLen = GetDlgItemText(hWnd, IDC_EDIT_TEAM, szTeam, sizeof(szTeam)/sizeof(TCHAR)+1);
if ((iNameLen < 3) || (iTeamLen < 2))
return FALSE;
#ifndef KG
iSNLen = GetDlgItemText(hWnd, IDC_EDIT_SERIAL, szSerial, sizeof(szSerial)/sizeof(TCHAR)+1);
if (iSNLen != 32)
return FALSE;
Str2Hex(szSerial, 32, szTemp);
strncpy(szSerial, szTemp, 16);
#endif
//FHD(name)
FHD_Init(&fhd_ctx);
FHD_Update(&fhd_ctx, szName, iNameLen);
FHD_Final(Hash, &fhd_ctx);
//RC4(FHD(name), szTeam)
RC4_Set_Key(&rc4_key, szTeam, iTeamLen);
RC4(&rc4_key, Hash, 16, szTeam);
//RC6_decrypt("好好学习天天向上", sn);
rc6_key_setup(rc6Key, 16);
#ifndef KG
rc6_block_decrypt((unsigned int *)szSerial, (unsigned int *)szTemp);
if (strncmp(szTeam, szTemp, 16) != 0)
return FALSE;
#else
rc6_block_encrypt((unsigned int *)szTeam, (unsigned int *)szSerial);
#endif
return TRUE;
}
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!