Код (Text): .386 .model flat,stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\user32.inc include \masm32\include\kernel32.inc includelib \masm32\lib\user32.lib includelib \masm32\lib\kernel32.lib S macro pdata:VARARG LOCAL Buff .data ifidni <pdata>,<> Buff db 0 else Buff db pdata,0 endif .code exitm <OFFSET Buff> endm .data TempBuf DB 64 dup(0) .code z0mbie_Crc32 proc uses ebx ecx edx pData:dword,tSize:dword ; input: EDX=data, ECX=size, EAX=crc ; output: EAX=crc, EDX+=ECX, ECX=BL=0 mov edx,pData mov ecx,tSize xcrc32: jecxz @@4 not eax @@1: xor al, [edx] inc edx mov bl, 8 @@2: shr eax, 1 jnc @@3 xor eax, 0EDB88320h @@3: dec bl jnz @@2 loop @@1 not eax @@4: ret z0mbie_Crc32 endp start: invoke RtlZeroMemory,addr TempBuf,64 invoke lstrlen,S("i'm a foolisher") mov ecx,eax mov edx,S("i'm a foolisher") invoke z0mbie_Crc32,edx,ecx invoke wsprintf,addr TempBuf,S("%X"),EAX invoke MessageBox,NULL,addr TempBuf,S("TEST_111"),MB_OK invoke ExitProcess, 0 end start the crc32 value "ED481EB3" is used by other way. the z0mbie's CRC32 value is "B9C0DD2E". what' wrong i used the z0mbie's CRC32?
hmmm... are you sure about your result? i've used this algo and got ED481EB3. Try to look in debugger what's goes wrong
dcskm4200 Something wrong, look at: z0mbie_Crc32 proc uses ebx ecx edx pData:dword,tSize:dword ; input: EDX=data, ECX=size, EAX=crc and reg eax used in proc body:
input eax=crc=0xDB710641 but this algo glitches on data - e.g. [A] 1 byte long (without brackets of course). Tested with winrar) and online crc32 calc.
thanks you who answered the question, especially thanks crypto. the z0mbie's crc32 arithmetic is powerful.