BDE 4.14.0 Production release
|
Provide a mechanism for computing the CRC-64 checksum of a dataset.
bdlde::Crc64
implements a mechanism for computing, updating, and streaming a CRC-64 checksum (a cyclic redundancy check comprising 64 bits). This checksum is a strong and fast technique for determining whether a message was received without errors. Note that a CRC-64 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::Crc64
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-64 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-64 checksum from a bdex
input stream, then perform a local CRC-64 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: