Data Scrambler Class & Demo

I pushed a new repo to Github, for scrambling data.

The demo requires C10 or higher, but some of the earlier C10 versions might not be able to compile it because of the differences in SystemStringClass over the course of C10’s releases.

I’ll try to make a demo that will work for earlier versions when I get a chance.



Cool! Thank you Jeff!

1 Like

This is an interesting comment

This function is used instead of the built-in Clarion CRC32 for compatibility with other languages

How many different ways can CRC32 work?

Cyclic redundancy check - Wikipedia

I see further down in the link, that it appears there are a number of factors which can alter the result, it seems that the first stage of choice and use of different polynomials can affect the result along with the factors mentioned in the specifications:
Cyclic redundancy check - Wikipedia

RFC 3385: Internet Protocol Small Computer System Interface (iSCSI) Cyclic Redundancy Check (CRC)/Checksum Considerations (

We will also attempt to compare Cyclic Redundancy Checks (CRCs) with
other checksum forms (e.g., Fletcher, Adler, weighted checksums), as
permitted by available data.

RFC 3309 - Stream Control Transmission Protocol (SCTP) Checksum Change (

Stream Control Transmission Protocol (SCTP) currently uses an Adler-
32 checksum. For small packets Adler-32 provides weak detection of
errors. This document changes that checksum and updates SCTP to use
a 32 bit CRC checksum.

I thought there was only one CRC32, that was universally accepted across the IT world, but it appears not.

This is an interesting answer to a question.
hash - CRC32 vs CRC32C? - Stack Overflow

CRC32C uses a different polynomial (0x1EDC6F41, reversed 0x82F63B78) but otherwise the computation is the same. The results are different, naturally. This is also known as the Castagnoli CRC32 and most conspicuously found in newer Intel CPUs which can compute a full 32-bit CRC step in 3 cycles. That is the reason why the CRC32C is becoming more popular, since it allows advanced implementations that effectively process one 32-bit word per cycle despite the three-cycle latency (by processing 3 streams of data in parallel and using linear algebra to combine the results).

So is this offering using the CRC32C aka CRC32 Castagnoli , that is a 3 cycle calculation?

Asking for a friend. :wink:

no it is not. It would take many more cycles than that. It was based on some C code I found on the net. It does not have any pre-computed table lookups which are often used to speed things up. But this code is about as fast as I could get while keeping it “simple”.

In case you are interested Richard, I’ve just done a bit of searching and I believe this was my original c code reference:

Ok. [Post must be at least 20 characters]

I pushed up some changes to my data scrambler. Added a hex output to the demo and some other changes.