flat assembler
Message board for the users of flat assembler.

Index > Windows > CRC32 Calculation ( Sorry for posting so many threads)

Author
Thread Post new topic Reply to topic
crc32



Joined: 17 Nov 2004
Posts: 5
crc32
in a CRC32 calculation, the parameters are
Name : "CRC-32"
Width : 32
Poly : 04C11DB7
Init : FFFFFFFF
RefIn : True
RefOut : True
XorOut : FFFFFFFF


say the message = "1" which is "0011001"
no the RefIn and RefOut are all True.
The Init value is FFFFFFFF
do we
#1 reflect the message first then add attach initial value?
11111111111111111111111111111111 10001100 followed by 32 Zeros

#2 attach the initial value then reflect
10001100 11111111111111111111111111111111 followed by 32 Zeros

I am doing a manual calculation now....to see if I can get the correct answer.

thx for the help in advance.

jim

_________________
CRC32 Manual Calculation: HELP>>>> I am stuck
Post 19 Nov 2004, 00:17
View user's profile Send private message Reply with quote
bogdanontanu



Joined: 07 Jan 2004
Posts: 403
Location: Sol. Earth. Europe. Romania. Bucuresti
bogdanontanu
Heh, for somebody with "crc32" name ... is this ironical or what?
Post 19 Nov 2004, 01:20
View user's profile Send private message Visit poster's website Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
hy,
i see you're serious about the problem , but could you describe your problem?
why is it good for you to post similar in many posts? you won't get more help that way.
if your problem is manual calculation, then it fully depends on you if you can do it without a computer.
ps.: anyway crc i guess is not os dependent, so it could fit easily in main
Post 19 Nov 2004, 01:29
View user's profile Send private message Visit poster's website Reply with quote
crc32



Joined: 17 Nov 2004
Posts: 5
crc32
Hi there,
The problem is manually calculation CRC values...
I can get the crc values from code with ease... but I need to understand how to do it manually, so that I can work with NON-STANDARD POLY.

The reason for putting in different threads = they are all different problems, but all related to CRC. I figured if I put them all in one thread, I will confuse more people.

I don't have a problem calculating with computer, but I do have a problem doing Long-Hand calculation. If you know how to do it for CRC32, then please advice.

thanks for your time reading.

regards
Jim

Matrix wrote:
hy,
i see you're serious about the problem , but could you describe your problem?
why is it good for you to post similar in many posts? you won't get more help that way.
if your problem is manual calculation, then it fully depends on you if you can do it without a computer.
ps.: anyway crc i guess is not os dependent, so it could fit easily in main

_________________
CRC32 Manual Calculation: HELP>>>> I am stuck
Post 19 Nov 2004, 02:07
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1171
Location: Overflow
Matrix
Code:
PROGRAM CRCTable;
 {CRCTable generates the table of constants needed for byte-wise CRC-16
  calculations.  The constants are formatted for inclusion in the
  CRC UNIT.

  (C) Copyright 1989, Earl F. Glynn, Overland Park, KS.  Compuserve 73257,3527.
  All Rights Reserved.  This Turbo Pascal 5.5 PROGRAM may be freely distributed
  for non-commercial use.

  This program was derived from the CRCV FORTRAN 77 program given in
  "Byte-wise CRC Calculations" by Aram Perez in IEEE Micro, June 1983,
  pp. 40-50.  The constants here are for the CRC-16 generator polynomial
  X^16 + X^15 + X^2 + 1.  Other generator polynomials could be used
  but a new derivation would be needed to calculate the 'v' variables
  below.}

  CONST
    hexdigit:  ARRAY[0..15] OF CHAR = '0123456789ABCDEF';
    v       :  ARRAY[1..16] OF 0..1 = (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
  VAR
    count:  0..256;
    i,j  :  1..4;
    k,sum:  0..16;
    x,x1,x2,x3,x4,x5,x6,x7,x8:  0..1;
BEGIN
  count := 0;
  FOR x8 := 0 TO 1 DO
    FOR x7 := 0 TO 1 DO
      FOR x6 := 0 TO 1 DO
        FOR x5 := 0 TO 1 DO
          FOR x4 := 0 TO 1 DO
            FOR x3 := 0 TO 1 DO
              FOR x2 := 0 TO 1 DO
                FOR x1 := 0 TO 1 DO BEGIN
                  x := x7 XOR x6 XOR x5 XOR x4 XOR x3 XOR x2 XOR x1;
                  v[16] := x8 XOR x;
                  v[15] := x;
                  v[14] := x8 XOR x7;
                  v[13] := x7 XOR x6;
                  v[12] := x6 XOR x5;
                  v[11] := x5 XOR x4;
                  v[10] := x4 XOR x3;
                  v[ 9] := x3 XOR x2;
                  v[ 8] := x2 XOR x1;
                  v[ 7] := x1;
                  v[ 1] := x8 XOR x;
                  k := 16;
                  WRITE ('$');
                  FOR i := 1 TO 4 DO BEGIN
                    FOR j := 1 TO 4 DO BEGIN
                      IF   j = 1
                      THEN sum := v[k]
                      ELSE sum := 2*sum + v[k];
                      DEC (k)
                    END;
                    WRITE (hexdigit[sum])
                  END;
                  WRITE (',');
                  INC (count);
                  IF   count MOD 11 = 0
                  THEN WRITELN
                END
END {CRCTable}.
    

this helps?
you can find more here
and a google search here
Post 19 Nov 2004, 02:34
View user's profile Send private message Visit poster's website 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.

Powered by rwasa.