II proto :dword,:dword,:dword,:dword,:dword,:byte,:dword procMD5hash proto :dword,:dword,:dword include \masm32\include\gdi32.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc include \masm32\include\windows.inc includelib \masm32\lib\gdi32.lib includelib \masm32\lib\kernel32.lib includelib \masm32\lib\user32.lib MD5RESULT STRUCT dtA dd ? dtB dd ? dtC dd ? dtD dd ? MD5RESULT ENDS .const IDC_ABOUT equ 101 IDC_EDITTEXT equ 102 IDC_EDITHASH equ 103 IDD_DIALOG equ 100 IDI_ICON equ 200 MAXSIZE equ 260 .data bfBuffer db MAXSIZE dup (0) szAboutCaption db 'about md5hasher',0 szAboutText db 'md5hasher',13,10,'by roy|crisiscrackers',0 szMD5Format db '%.8x%.8x%.8x%.8x',0 .data? hInstance HINSTANCE ? stMD5Result MD5RESULT <?> .code start: invoke GetModuleHandle,0 mov hInstance,eax invoke DialogBoxParam,hInstance,IDD_DIALOG,0,addr DlgProc,0 invoke ExitProcess,eax DlgProc proc uses ebx edi esi,hWnd:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARA M cmp uMsg,WM_INITDIALOG jz initdialog cmp uMsg,WM_CLOSE jz close cmp uMsg,WM_COMMAND jz command xor eax,eax ret endcheck: mov eax,1 ret command: mov eax,wParam mov edx,wParam shr edx,16 cmp edx,BN_CLICKED jnz @f cmp ax,IDC_ABOUT jnz endcheck invoke MessageBoxA,hWnd,addr szAboutText,addr szAboutCaption,MB_OK or MB_ICONASTERISK jmp endcheck @@: cmp edx,EN_CHANGE jnz endcheck cmp ax,IDC_EDITTEXT jnz endcheck invoke GetDlgItemText,hWnd,IDC_EDITTEXT,addr bfBuffer,MAXSIZE invoke procMD5hash,addr bfBuffer,eax,addr stMD5Result invoke SendDlgItemMessageA,hWnd,IDC_EDITHASH,WM_SETTEXT,0 ,addr bfBuffer jmp endcheck initdialog: invoke LoadIconA,hInstance,IDI_ICON invoke SendMessageA,hWnd,WM_SETICON,1,eax invoke SendDlgItemMessageA,hWnd,IDC_EDITTEXT,WM_SETTEXT,0 ,0 jmp endcheck close: invoke EndDialog,hWnd,0 jmp endcheck DlgProc endp procMD5hash proc uses eax ebx ecx edx edi esi,ptBuffer:dword,dtBufferLength:dword,ptMD5Resul t:dword local dta:dword,dtb:dword,dtc:dword,dtd:dword ; phase I · padding mov edi,ptBuffer mov eax,dtBufferLength inc eax add edi,eax mov byte ptr [edi-1],080h xor edx,edx mov ebx,64 div ebx neg edx add edx,64 cmp edx,8 jae @f add edx,64 @@: mov ecx,edx xor al,al rep stosb mov eax,dtBufferLength inc edx add dtBufferLength,edx xor edx,edx mov ebx,8 mul ebx mov dword ptr [edi-8],eax mov dword ptr [edi-4],edx mov edx,dtBufferLength mov edi,ptBuffer ; phase II · chaining variables initialization mov esi,ptMD5Result assume esi:ptr MD5RESULT mov [esi].dtA,067452301h mov [esi].dtB,0efcdab89h mov [esi].dtC,098badcfeh mov [esi].dtD,010325476h ; phase III · hashing hashloop: mov eax,[esi].dtA mov dta,eax mov eax,[esi].dtB mov dtb,eax mov eax,[esi].dtC mov dtc,eax mov eax,[esi].dtD mov dtd,eax ; round 1 invoke FF,dta,dtb,dtc,dtd,dword ptr [edi+00*4],07,0d76aa478h mov dta,eax invoke FF,dtd,dta,dtb,dtc,dword ptr [edi+01*4],12,0e8c7b756h mov dtd,eax invoke FF,dtc,dtd,dta,dtb,dword ptr [edi+02*4],17,0242070dbh mov dtc,eax invoke FF,dtb,dtc,dtd,dta,dword ptr [edi+03*4],22,0c1bdceeeh mov dtb,eax invoke FF,dta,dtb,dtc,dtd,dword ptr [edi+04*4],07,0f57c0fafh mov dta,eax invoke FF,dtd,dta,dtb,dtc,dword ptr [edi+05*4],12,04787c62ah mov dtd,eax invoke FF,dtc,dtd,dta,dtb,dword ptr [edi+06*4],17,0a8304613h mov dtc,eax invoke FF,dtb,dtc,dtd,dta,dword ptr [edi+07*4],22,0fd469501h mov dtb,eax invoke FF,dta,dtb,dtc,dtd,dword ptr [edi+08*4],07,0698098d8h mov dta,eax invoke FF,dtd,dta,dtb,dtc,dword ptr [edi+09*4],12,08b44f7afh