; F(x,y,z) = (x and y) or ((not x) and z)
; a =((a + F(b,c,d) + x + t) << s ) + b
_FProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
and ebx,eax
not eax
and eax,ecx
or eax,ebx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; G(x,y,z) = (x and z) or (y and (not z))
; a = ((a + G(b,c,d) + x + t) << s) + b
_GProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; H(x,y,z) = x xor y xor z
; a = ((a + H(b,c,d) + x + t) << s) + b
_HProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
xor eax,ebx
xor eax,ecx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; I(x,y,z) = y xor (x or (not z))
; a = ((a + I(b,c,d) + x + t) << s) + b
_IProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
_MD5hashProc proc uses edi esi,_lpFileMem,_dwFileSize,_lpdwMD5Buffer
local @dwA,@dwB,@dwC,@dwD
LOCAL @dwRotateCount
LOCAL @dwEndRotateCount
LOCAL @szBuffer1[128]:byte
szClassName db "Class",0
szWindowName db "MD5加密算法",0
szEdit db "Edit",0
szButton db "Button",0
szBtMD5 db '开始MD5',0
szBtTerminateMD5 db '终止MD5',0
szBtFileName db '文件...',0
szStrFilter db "所有文件(*.*)",0,"*.*",0,0
szCurrentFilePath db MAX_PATH dup (?)
szFileName db MAX_PATH dup (?)
align dword
dwFLeftMove db 07,12,17,22
dwGLeftMove db 05,09,14,20
dwHLeftMove db 04,11,16,23
dwILeftMove db 06,10,15,21
dwFOffset db 00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15
dwGOffset db 01,06,11,00,05,10,15,04,09,14,03,08,13,02,07,12
dwHOffset db 05,08,11,14,01,04,07,10,13,00,03,06,09,12,15,02
dwIOffset db 00,07,14,05,12,03,10,01,08,15,06,13,04,11,02,09
; F(x,y,z) = (x and y) or ((not x) and z)
; a =((a + F(b,c,d) + x + t) << s ) + b
_FProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
and ebx,eax
not eax
and eax,ecx
or eax,ebx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; G(x,y,z) = (x and z) or (y and (not z))
; a = ((a + G(b,c,d) + x + t) << s) + b
_GProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; H(x,y,z) = x xor y xor z
; a = ((a + H(b,c,d) + x + t) << s) + b
_HProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
xor eax,ebx
xor eax,ecx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; I(x,y,z) = y xor (x or (not z))
; a = ((a + I(b,c,d) + x + t) << s) + b
_IProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
_MD5hashProc proc uses edi esi,_lpFileMem,_dwFileSize,_lpdwMD5Buffer
local @dwA,@dwB,@dwC,@dwD
LOCAL @dwRotateMD5Count
LOCAL @dwEndRotateMD5Count
LOCAL @szBuffer1[128]:byte
.if esi < 16;F
and ebx,eax
not eax
and eax,ecx
or eax,ebx
.elseif esi < 32;G
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
.elseif esi < 48;H
xor eax,ebx
xor eax,ecx
.else ;I
not ecx
or eax,ecx
xor eax,ebx
.endif
szClassName db "Class",0
szWindowName db "MD5加密算法",0
szEdit db "Edit",0
szButton db "Button",0
szBtMD5 db '开始MD5',0
szBtTerminateMD5 db '终止MD5',0
szBtFileName db '文件...',0
szStrFilter db "所有文件(*.*)",0,"*.*",0,0
szCurrentFilePath db MAX_PATH dup (?)
szFileName db MAX_PATH dup (?)
align dword
dwFLeftMove db 07,12,17,22
dwGLeftMove db 05,09,14,20
dwHLeftMove db 04,11,16,23
dwILeftMove db 06,10,15,21
dwFOffset db 00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15
dwGOffset db 01,06,11,00,05,10,15,04,09,14,03,08,13,02,07,12
dwHOffset db 05,08,11,14,01,04,07,10,13,00,03,06,09,12,15,02
dwIOffset db 00,07,14,05,12,03,10,01,08,15,06,13,04,11,02,09
; F(x,y,z) = (x and y) or ((not x) and z)
; a =((a + F(b,c,d) + x + t) << s ) + b
_FProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
and ebx,eax
not eax
and eax,ecx
or eax,ebx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; G(x,y,z) = (x and z) or (y and (not z))
; a = ((a + G(b,c,d) + x + t) << s) + b
_GProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; H(x,y,z) = x xor y xor z
; a = ((a + H(b,c,d) + x + t) << s) + b
_HProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
xor eax,ebx
xor eax,ecx
_LeftMov@MD5 _dwA,_dwB,x,s,t
endm
; I(x,y,z) = y xor (x or (not z))
; a = ((a + I(b,c,d) + x + t) << s) + b
_IProc@MD5 macro _dwA,_dwB,_dwC,_dwD,x,s,t
mov eax,_dwB
mov ebx,_dwC
mov ecx,_dwD
_MD5hashProc proc uses edi esi,_lpFileMem,_dwFileSize,_lpszMD5Buffer
local @dwA,@dwB,@dwC,@dwD
LOCAL @dwRotateMD5Count
LOCAL @dwEndRotateMD5Count
LOCAL @szBuffer1[128]:byte
LOCAL @dwFTi[64]:dword
LOCAL @bEndMD5
LOCAL @dbFileSizeInBuffer:byte
LOCAL @dwTiCount
LOCAL @dwTiN0
LOCAL @dwTiN1
LOCAL @dwTiN2
LOCAL @wCW:word
.if esi < 16;F
and ebx,eax
not eax
and eax,ecx
or eax,ebx
.elseif esi < 32;G
and eax,ecx
not ecx
and ecx,ebx
or eax,ecx
.elseif esi < 48;H
xor eax,ebx
xor eax,ecx
.else ;I
not ecx
or eax,ecx
xor eax,ebx
.endif