Public Member Functions

MD5 Class Reference

MD5 checksum class. More...

List of all members.

Public Member Functions

 MD5 ()
 Creates a null MD5 object.
 MD5 (const MD5 &other)
 Creates a copy of another MD5.
MD5operator= (const MD5 &other)
 Copies another MD5.
 MD5 (const MemoryBlock &data)
 Creates a checksum for a block of binary data.
 MD5 (const void *data, size_t numBytes)
 Creates a checksum for a block of binary data.
 MD5 (const String &text)
 Creates a checksum for a string.
 MD5 (InputStream &input, int64 numBytesToRead=-1)
 Creates a checksum for the input from a stream.
 MD5 (const File &file)
 Creates a checksum for a file.
 ~MD5 ()
 Destructor.
MemoryBlock getRawChecksumData () const
 Returns the checksum as a 16-byte block of data.
String toHexString () const
 Returns the checksum as a 32-digit hex string.
bool operator== (const MD5 &other) const
 Compares this to another MD5.
bool operator!= (const MD5 &other) const
 Compares this to another MD5.

Detailed Description

MD5 checksum class.

Create one of these with a block of source data or a string, and it calculates the MD5 checksum of that data.

You can then retrieve this checksum as a 16-byte block, or as a hex string.


Constructor & Destructor Documentation

MD5::MD5 (  )

Creates a null MD5 object.

MD5::MD5 ( const MD5 other )

Creates a copy of another MD5.

MD5::MD5 ( const MemoryBlock data ) [explicit]

Creates a checksum for a block of binary data.

MD5::MD5 ( const void *  data,
size_t  numBytes 
)

Creates a checksum for a block of binary data.

MD5::MD5 ( const String text ) [explicit]

Creates a checksum for a string.

Note that this operates on the string as a block of unicode characters, so the result you get will differ from the value you'd get if the string was treated as a block of utf8 or ascii. Bear this in mind if you're comparing the result of this method with a checksum created by a different framework, which may have used a different encoding.

MD5::MD5 ( InputStream input,
int64  numBytesToRead = -1 
)

Creates a checksum for the input from a stream.

This will read up to the given number of bytes from the stream, and produce the checksum of that. If the number of bytes to read is negative, it'll read until the stream is exhausted.

MD5::MD5 ( const File file ) [explicit]

Creates a checksum for a file.

MD5::~MD5 (  )

Destructor.


Member Function Documentation

MD5& MD5::operator= ( const MD5 other )

Copies another MD5.

MemoryBlock MD5::getRawChecksumData (  ) const

Returns the checksum as a 16-byte block of data.

String MD5::toHexString (  ) const

Returns the checksum as a 32-digit hex string.

bool MD5::operator== ( const MD5 other ) const

Compares this to another MD5.

bool MD5::operator!= ( const MD5 other ) const

Compares this to another MD5.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines