[erlang-questions] erlang and crc32

Matthias Lang <>
Wed Feb 10 10:35:51 CET 2010


Hi,

I saw that someone else already gave you code, so I won't.

> 1) are there really different flavours of crc32?

Yes. There are at least two different CRC32 in common use, the
'ethernet' one and the 'SCTP' one. Erlang appears to provide the
ethernet one. (IIRC, the CRC32 used in ATM AAL5 is different again)

The wikipedia page about CRCs has a nice table of popular CRCs:

  http://en.wikipedia.org/wiki/Cyclic_redundancy_check

> 2) can I rearrange my data so, that erlang:crc32 or any other default
> function will work?

I'm not sure.

According to the wikipedia table, MPEG-2 uses the IEEE 802.3
CRC32. But I don't know if MPEG-2 is the same thing as what you're
working on (MPEG TS). I don't know anything about MPEG.

If the function "Rapsey" gave you works and it's fast enough, you're
probably happy. Otherwise, you probably want to implement it in C,
perhaps as a NIF. If you're feeling heroic, extending erlang:crc32 to
handle all possible crc32 would be neat.

(Aside: I have an Erlang module which can compute arbitrary CRC4, 6,
8, 16 and 32. I don't want to post it because it's a mess. If someone
wants it anyway, mail me.)

Matt


More information about the erlang-questions mailing list