BDE 4.14.0 Production release
|
#include <bdlde_md5.h>
Public Types | |
typedef bsls::AlignedBuffer< 16 > | Md5Digest |
Public Member Functions | |
Md5 () | |
Md5 (const void *data, int length) | |
Md5 (const Md5 &original) | |
~Md5 () | |
Destroy this MD5 digest. | |
template<class STREAM > | |
STREAM & | bdexStreamIn (STREAM &stream, int version) |
void | reset () |
void | update (const void *data, int length) |
void | loadDigestAndReset (Md5Digest *result) |
template<class STREAM > | |
STREAM & | bdexStreamOut (STREAM &stream, int version) const |
bsl::ostream & | print (bsl::ostream &stream) const |
void | loadDigest (Md5Digest *result) const |
Static Public Member Functions | |
static int | maxSupportedBdexVersion (int) |
static int | maxSupportedBdexVersion () |
Friends | |
bool | operator== (const Md5 &, const Md5 &) |
This class
represents an MD5 digest that can be updated as additional data is provided.
More generally, this class supports a complete set of value semantic operations, including copy construction, assignment, equality comparison, ostream
printing, and bdex
serialization. (A precise operational definition of when two instances have the same value can be found in the description of operator==
for the class.) This container is exception neutral with no guarantee of rollback: if an exception is thrown during the invocation of a method on a pre-existing instance, the class is left in a valid state, but its value is undefined. In no event is memory leaked. Finally, aliasing (e.g., using all or part of an object as both source and destination) is supported in all cases.
See bdlde_md5
typedef bsls::AlignedBuffer<16> bdlde::Md5::Md5Digest |
A maximally-aligned, 16-byte object type used to represent an MD5 digest.
bdlde::Md5::Md5 | ( | ) |
Construct an MD5 digest having the value corresponding to no data having been provided.
bdlde::Md5::Md5 | ( | const void * | data, |
int | length | ||
) |
Construct an MD5 digest corresponding to the specified data
having the specified length
(in bytes). The behavior is undefined unless 0 <= length
. Note that if data
is 0, then length
also must be 0.
bdlde::Md5::Md5 | ( | const Md5 & | original | ) |
Construct an MD5 digest having the value of the specified original
digest.
bdlde::Md5::~Md5 | ( | ) |
STREAM & bdlde::Md5::bdexStreamIn | ( | STREAM & | stream, |
int | version | ||
) |
Assign to this object the value read from the specified input stream
using the specified version
format and return a reference to the modifiable stream
. If stream
is initially invalid, this operation has no effect. If stream
becomes invalid during this operation, this object is valid, but its value is undefined. If the specified version
is not supported, stream
is marked invalid, but this object is unaltered. Note that no version is read from stream
. (See the package-group-level documentation for more information on bdex
streaming of container types.)
STREAM & bdlde::Md5::bdexStreamOut | ( | STREAM & | stream, |
int | version | ||
) | const |
Write this value to the specified output stream
and return a reference to the modifiable stream
. Optionally specify an explicit version
format; by default, the maximum supported version is written to stream
and used as the format. If version
is specified, that format is used, but not written to stream
. If version
is not supported, stream
is left unmodified. (See the package-group-level documentation for more information on bdex
streaming of container types).
void bdlde::Md5::loadDigest | ( | Md5Digest * | result | ) | const |
Load the current value of this MD5 digest into the specified result
.
void bdlde::Md5::loadDigestAndReset | ( | Md5Digest * | result | ) |
Load the current value of this MD5 digest into the specified result
and set the value of this MD5 digest to the value provided by the default constructor.
|
inlinestatic |
Return the most current bdex
streaming version number supported by this class. (See the package-group-level documentation for more information on bdex
streaming of container types.)
|
inlinestatic |
Return the maximum valid BDEX format version, as indicated by the specified versionSelector
, to be passed to the bdexStreamOut
method. Note that the versionSelector
is expected to be formatted as yyyymmdd
, a date representation. See the bslx
package-level documentation for more information on BDEX streaming of value-semantic types and containers.
bsl::ostream & bdlde::Md5::print | ( | bsl::ostream & | stream | ) | const |
Format the current value of this MD5 digest to the specified output stream
and return a reference to the modifiable stream
.
void bdlde::Md5::reset | ( | ) |
Reset the value of this MD5 digest to the value provided by the default constructor.
void bdlde::Md5::update | ( | const void * | data, |
int | length | ||
) |
Update the value of this MD5 digest to incorporate the specified data
having the specified length
in bytes. If the current state is the default state, the resultant value of this MD5 digest is the application of the MD5 algorithm upon the currently given data
of the given length
. If this digest has been previously provided data and has not been subsequently reset, the current state is not the default state and the resultant value is equivalent to applying the MD5 algorithm upon the concatenation of all the provided data. The behavior is undefined unless 0 <= length
. Note that if data
is 0, then length
also must be 0.
Return true
if the specified lhs
and rhs
MD5 digests have the same value, and false
otherwise. Two digests have the same value if the values obtained from their respective loadDigest
methods are identical.