ScummVM API documentation
MD5 checksum

Description

API for computing the MD5 checksum.

Functions

bool Common::computeStreamMD5 (ReadStream &stream, uint8 digest[16], uint32 length=0)
 
String Common::computeStreamMD5AsString (ReadStream &stream, uint32 length=0)
 

Function Documentation

◆ computeStreamMD5()

bool Common::computeStreamMD5 ( ReadStream stream,
uint8  digest[16],
uint32  length = 0 
)

Compute the MD5 checksum of the content of the given ReadStream. The 128 bit MD5 checksum is returned directly in the array digest. If length is set to a positive value, then only the first length bytes of the stream are used to compute the checksum.

Parameters
[in]streamthe stream of whose data the MD5 is computed
[out]digestthe computed MD5 checksum
[in]lengththe number of bytes for which to compute the checksum; 0 means all
Returns
true on success, false if an error occurred

◆ computeStreamMD5AsString()

String Common::computeStreamMD5AsString ( ReadStream stream,
uint32  length = 0 
)

Compute the MD5 checksum of the content of the given ReadStream. The 128 bit MD5 checksum is converted to a human readable lowercase hex string of length 32. If length is set to a positive value, then only the first length bytes of the stream are used to compute the checksum.

Parameters
[in]streamthe stream of whose data the MD5 is computed
[in]lengththe number of bytes for which to compute the checksum; 0 means all
Returns
the MD5 as a hex string on success, and an empty string if an error occurred