flat assembler
Message board for the users of flat assembler.

Index > Tutorials and Examples > CRC-24

Thread Post new topic Reply to topic

Joined: 08 Jan 2018
Posts: 442
this CRC-24 is used by OpenPGP, pretty simple one.

  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
    movzx               edx,byte [esi+edi]
    shl                 edx,10h
    xor                 eax,edx
    mov                 edx,8
    shl                 eax,1
    test                eax,01000000h
    jz                  update
    xor                 eax,ebx
    dec                 edx
    jnz                 _loop
    inc                 edi
    cmp                 edi,ecx
    jnz                 begin
    and                 eax,00FFFFFFh
    cinvoke             itoa,eax,checksum,10h
    invoke              MessageBox,0,0,eax,0
    sub                 eax,eax

section '.data' data readable writeable

  length dd 4
  _data db 'fasm',0
  checksum rb 6

section '.idata' import data readable

  library user32,'user32.dll',\

  import user32,\

  import ntdll,\

section '.reloc' fixups data readable discardable    

Asm For Wise Humans
Post 13 May 2021, 06:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum

Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.