BDE 4.14.0 Production release
|
Provide a mechanism for computing the CRC-32 checksum of a dataset.
This component implements a mechanism for computing, updating, and streaming a CRC-32 checksum (a cyclic redundancy check comprised of 32 bits). This checksum is a strong and fast technique for determining whether or not a message was received without errors. Note that a CRC-32 checksum does not aid in error correction and is not naively useful in any sort of cryptographic application. Compared to other methods such as MD5 and SHA-256, it is relatively easy to find alternate texts with identical checksum.
This section illustrates intended use of this component.
The following snippets of code illustrate a typical use of the bdlde::Crc32
class. Each function would typically execute in separate processes or potentially on separate machines. The senderExample
function below demonstrates how a message sender can write a message and its CRC-32 checksum to a bdex
output stream. Note that Out
may be a typedef
of any class that implements the bslx::OutStream
protocol:
The receiverExample
function below illustrates how a message receiver can read a message and its CRC-32 checksum from a bdex
input stream, then perform a local CRC-32 computation to verify that the message was received intact. Note that In
may be a typedef
of any class that implements the bslx::InStream
protocol: