Non-math-geek needs help with CRCs (binascii.crc32)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nobody

    Non-math-geek needs help with CRCs (binascii.crc32)

    1) Does anyone know if the CRC32 algorithm in binascii has a name? There
    seem to be a TON of different CRC32 methods; different polynomials,
    different byte orders, different seeds, some flip the bits and some XOR the
    result with something else.

    I've been looking around and a lot of documents (RFCs, etc) refer to ISO3309
    and/or ITU-T V.42 (neither of which appear to be available without paid
    access), yet are often incompatible with each other. So unless they're
    lying, I assume ISO3309 allows for the above variations, and specifying an
    ISO3309 CRC32 doesn't narrow it down any.

    2) With Python 2.4 and its signed hex(), what's the 'best'/shortest
    (preferably one operation, without any if x < 0 business) way to get an
    unsigned 32bit CRC?


    Thanks all.



  • Nick Craig-Wood

    #2
    Re: Non-math-geek needs help with CRCs (binascii.crc32 )

    nobody <get@bent.com > wrote:[color=blue]
    > 1) Does anyone know if the CRC32 algorithm in binascii has a name? There
    > seem to be a TON of different CRC32 methods; different polynomials,
    > different byte orders, different seeds, some flip the bits and some XOR the
    > result with something else.
    >
    > I've been looking around and a lot of documents (RFCs, etc) refer to ISO3309
    > and/or ITU-T V.42 (neither of which appear to be available without paid
    > access), yet are often incompatible with each other. So unless they're
    > lying, I assume ISO3309 allows for the above variations, and specifying an
    > ISO3309 CRC32 doesn't narrow it down any.[/color]

    Look here



    and in particular here



    For Ross N. Williams's thoughts on CRCs. Well worth reading IMHO.
    You'll find interesting the section on the different way each CRC can
    be used (reversed, reflected etc).

    If you have a sample of data, its usually pretty easy to work out
    which CRC it does actually use by trial and error. You can use the
    code Ross provides to help.

    --
    Nick Craig-Wood
    ncw@axis.demon. co.uk

    Comment

    • Peter Hansen

      #3
      Re: Non-math-geek needs help with CRCs (binascii.crc32 )

      Nick Craig-Wood wrote:[color=blue]
      > nobody <get@bent.com > wrote:
      >[color=green]
      >> 1) Does anyone know if the CRC32 algorithm in binascii has a name? There
      >> seem to be a TON of different CRC32 methods; different polynomials,[/color][/color]
      [color=blue]
      > If you have a sample of data, its usually pretty easy to work out
      > which CRC it does actually use by trial and error. You can use the
      > code Ross provides to help.[/color]

      Probably _much_ easier just to check the source. (It's not
      in Python, though, it's in the C source this time...)

      Comment

      Working...