flat assembler
Message board for the users of flat assembler.
Index
> Macroinstructions > CRC32 calculating macros |
Author |
|
revolution 31 Mar 2009, 06:14
Nice to see you are using the table method for CRC.
Not sure if you have seen it before, but if you are interested in computing file signatures with macros then see: SHA512 macros |
|||
31 Mar 2009, 06:14 |
|
Grom PE 31 Mar 2009, 06:36
revolution, yes, I've seen your SHA512 macros, haven't got a practical use for them, but source of inspiration =)
|
|||
31 Mar 2009, 06:36 |
|
revolution 31 Mar 2009, 07:06
Since you are using the ISO3309 polynomial do you know what is special about this value: 0x2144DF1C? Answer below.
I use it in a lot of my crc checks. If you append the computed crc to the end of the message and then the receiver computes the crc of the entire received message (including the crc) the magic value 0x2144DF1C always appears. |
|||
31 Mar 2009, 07:06 |
|
Grom PE 31 Mar 2009, 07:18
Interesting, I didn't know about this.
Is there much difference anyway between calculating CRC of message+CRC then checking against 0x2144DF1C and calculating CRC of message and checking against the received CRC? |
|||
31 Mar 2009, 07:18 |
|
revolution 31 Mar 2009, 07:28
Not really a lot of difference, but a neat mathematical trick.
I used it the do checking on blocks of NAND flash. I have one optimised function to compute CRC that is based upon a 32 bytes per loop structure. If I didn't use the "magic" constant then I would have had to make an addition to the CRC loop and put in a special tail section to compute just the last 28 bytes. Instead, with the "magic" constant, I can do a full loop without special care and check for the fixed value 0x2144DF1C. |
|||
31 Mar 2009, 07:28 |
|
rugxulo 01 Apr 2009, 12:20
Nice job!
|
|||
01 Apr 2009, 12:20 |
|
revolution 04 May 2009, 11:43
Code: macro embed_crc start,finish { local b,c c = 0xffffffff repeat finish-start load b byte from start+%-1 c = c xor b repeat 8 c = (c shr 1) xor (0xedb88320 * (c and 1)) end repeat end repeat dd c xor 0xffffffff } Use like this Code: MyCode: mov eax,0x12345678 xor eax,edx ret embed_crc $$,$ |
|||
04 May 2009, 11:43 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.