18
18
* along with this program; if not, write to the Free Software
19
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21
* $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/tags/release-1-2-1/common/md5.h $
22
* $Id: md5.h 46108 2009-11-23 22:30:22Z fingolfin $
25
25
#ifndef COMMON_MD5_H
34
bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
36
// The following method work similar to the above one, but
37
// instead of computing the binary MD5 digest, it produces
38
// a human readable lowercase hexstring representing the digest.
39
// The md5str parameter must point to a buffer of 32+1 chars.
40
bool md5_file_string(ReadStream &stream, char *md5str, uint32 length = 0);
36
* Compute the MD5 checksum of the content of the given ReadStream.
37
* The 128 bit MD5 checksum is returned directly in the array digest.
38
* If length is set to a positive value, then only the first length
39
* bytes of the stream are used to compute the checksum.
40
* @param[in] stream the stream of whose data the MD5 is computed
41
* @param[out] digest the computed MD5 checksum
42
* @param[in] length the number of bytes for which to compute the checksum; 0 means all
43
* @return true on success, false if an error occurred
45
bool computeStreamMD5(ReadStream &stream, uint8 digest[16], uint32 length = 0);
48
* Compute the MD5 checksum of the content of the given ReadStream.
49
* The 128 bit MD5 checksum is converted to a human readable
50
* lowercase hex string of length 32.
51
* If length is set to a positive value, then only the first length
52
* bytes of the stream are used to compute the checksum.
53
* @param[in] stream the stream of whose data the MD5 is computed
54
* @param[in] length the number of bytes for which to compute the checksum; 0 means all
55
* @return the MD5 as a hex string on success, and an empty string if an error occurred
57
String computeStreamMD5AsString(ReadStream &stream, uint32 length = 0);
42
59
} // End of namespace Common