~ubuntu-branches/debian/jessie/scummvm/jessie

« back to all changes in this revision

Viewing changes to common/md5.h

  • Committer: Bazaar Package Importer
  • Author(s): Moritz Muehlenhoff
  • Date: 2011-05-25 19:02:23 UTC
  • mto: This revision was merged to the branch mainline in revision 23.
  • Revision ID: james.westby@ubuntu.com-20110525190223-fiqm0oaec714xk31
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
20
20
 *
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 $
 
21
 * $URL$
 
22
 * $Id$
23
23
 */
24
24
 
25
25
#ifndef COMMON_MD5_H
30
30
namespace Common {
31
31
 
32
32
class ReadStream;
33
 
 
34
 
bool md5_file(ReadStream &stream, uint8 digest[16], uint32 length = 0);
35
 
 
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);
 
33
class String;
 
34
 
 
35
/**
 
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
 
44
 */
 
45
bool computeStreamMD5(ReadStream &stream, uint8 digest[16], uint32 length = 0);
 
46
 
 
47
/**
 
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
 
56
 */
 
57
String computeStreamMD5AsString(ReadStream &stream, uint32 length = 0);
41
58
 
42
59
} // End of namespace Common
43
60