[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

*Subject*: **How to refer to the proper CRC32 algorithm for the track changes module?**

*From*:**"Schurig, Joachim" <Joachim.Schurig@lionbridge.com>***To*: "xliff@lists.oasis-open.org" <xliff@lists.oasis-open.org>*Date*: Tue, 19 Mar 2013 17:49:15 +0000

Hi everyone, as briefly discussed today in the call I wanted to hear your opinion how one can best refer to the CRC32 implementation I proposed to use in the Track Changes module which Ryan prepares. The problem with CRCs is that there are many algorithms. For CRC32 there are still 3 used ones, using different polynomials, so one needs to refer to the right one, and then it needs to be clarified which init and exit
operations are done on the calculated CRC value, because that is not determined by the polynomial. Just so everyone understands: the bulk of CRC32 implementations (in ZIP, Ethernet, ..) use the same algorithm and values – but there are more. And if you look e.g. at the English Wikipedia page about CRCs (http://en.wikipedia.org/wiki/Cyclic_redundancy_check)
you do not get the impression as if you can easily tell which one to pick (which is in practice not correct). The initial idea was to point to an existing standard. But that is difficult, because commonly people use a reference to RFC 1952 (http://www.ietf.org/rfc/rfc1952.txt),
which includes as appendix only a C code sample of an implementation. For a formal definition it refers to ISO 3309 (which is not publicly available, so I could not check the contents) and to ITU-T V.42. The latter is available, but it covers a lot more items
than only the CRC32 generation, which itself it explains correctly from the mathematical level, but probably not in a way that would help the average implementer. So the idea was to come up with pseudo code to make sure the right algorithm and init and exit values are understood. Is this anything you would deem suitable for a standards document like the XLIFF draft? Or should we only refer to the mathematical foundations, by pointing to ITU-T V.42 (http://www.itu.int/rec/T-REC-V.42/en)
? My proposed pseudo code looks like this: Pseudo code to generate the CRC32 bit-by-bit looks as follows (where it is assumed that the least significant bit is the rightmost): crc = 0xFFFFFFFF
crc = right shift(crc) XOR 0xEDB88320
crc = right shift(crc)
crc = crc XOR 0xFFFFFFFF Pseudo code to generate the CRC32 in the typical table driven approach looks as follows: Table generation:
crc = n
crc = right shift(crc) XOR 0xEDB88320
crc = right shift(crc)
CRC_TABLE[n] = crc
CRC calculation: crc = 0xFFFFFFFF
crc = CRC_TABLE[ (crc XOR input[n]) AND 0xFF ] XOR right shift(crc, 8)
crc = crc XOR 0xFFFFFFFF 0xEDB88320 is the reverse order representation of the coefficients of the polynomial
x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1 Thanks for any comments! (and I hope the code survives the list re-send halfways formatted) Joachim ________________________________ Lionbridge Fellow
1240 Route des Dolines 06560 Sophia Antipolis France |

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]