flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > CRC-24 |
Author |
|
Ali.Z 13 May 2021, 06:40
this CRC-24 is used by OpenPGP, pretty simple one.
Code: include 'win32a.inc' format PE console 4.0 section '.text' code readable executable mov eax,00B704CEh ; init mov ebx,01864CFBh ; poly mov esi,_data ; input mov ecx,[length] ; input length xor edi,edi ; used to iterate thru input begin: movzx edx,byte [esi+edi] shl edx,10h xor eax,edx mov edx,8 _loop: shl eax,1 test eax,01000000h jz update xor eax,ebx update: dec edx jnz _loop inc edi cmp edi,ecx jnz begin and eax,00FFFFFFh finish: cinvoke itoa,eax,checksum,10h invoke MessageBox,0,0,eax,0 sub eax,eax ret int3 section '.data' data readable writeable length dd 4 _data db 'fasm',0 checksum rb 6 section '.idata' import data readable library user32,'user32.dll',\ ntdll,'ntdll.dll' import user32,\ MessageBox,'MessageBoxA' import ntdll,\ itoa,'_itoa' section '.reloc' fixups data readable discardable _________________ Asm For Wise Humans |
|||
13 May 2021, 06:40 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.