Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
MD5 Class Reference

#include <elm/checksum/MD5.h>

+ Inheritance diagram for MD5:

Public Types

typedef unsigned char digest_t[16]
 

Public Member Functions

 MD5 (void)
 
virtual ~MD5 (void)
 
void digest (digest_t tab)
 
void print (io::Output &out)
 
void put (const void *buffer, t::uint32 length)
 
void put (const cstring &str)
 
void put (const string &str)
 
void put (io::InStream &in)
 
void put (io::InStream &in, int length)
 
MD5operator<< (const char *str)
 
MD5operator<< (const CString &str)
 
MD5operator<< (const String &str)
 
template<class T >
MD5operator<< (const T &value)
 
virtual int write (const char *buffer, int size)
 
virtual int flush (void)
 
virtual cstring lastErrorMessage (void)
 
- Public Member Functions inherited from OutStream
virtual ~OutStream (void)
 
virtual int write (char byte)
 
virtual bool supportsANSI () const
 

Additional Inherited Members

- Static Public Attributes inherited from OutStream
static OutStreamnull = _null
 

Detailed Description

Apply the MD5 algorithm (http://fr.wikipedia.org/wiki/MD5) to compute a checksum.

Data are checksummed calling any one of the put() methods (or using the overloaded operator <<). When all data has been checksummed, the checksum value is returned by digest().

Member Typedef Documentation

◆ digest_t

typedef unsigned char digest_t[16]

Constructor & Destructor Documentation

◆ MD5()

MD5 ( void  )

Build a new MD5 checksum builder.

◆ ~MD5()

~MD5 ( void  )
virtual

Member Function Documentation

◆ digest()

void digest ( digest_t  tab)

Get the check as 512 bits byte array.

Parameters
tabDigest result.

◆ flush()

int flush ( void  )
virtual

Cause the current stream to dump its buffer to the medium.

Returns
0 for success, less than 0 for error.

Implements OutStream.

◆ lastErrorMessage()

cstring lastErrorMessage ( void  )
virtual

Return a message for the last error.

Returns
Message of the last error.

Reimplemented from OutStream.

◆ operator<<() [1/4]

MD5& operator<< ( const char *  str)
inline

References MD5::put(), and elm::str().

◆ operator<<() [2/4]

MD5& operator<< ( const CString str)
inline

References MD5::put(), and elm::str().

◆ operator<<() [3/4]

MD5& operator<< ( const String str)
inline

References MD5::put(), and elm::str().

◆ operator<<() [4/4]

MD5& operator<< ( const T &  value)
inline

References MD5::put().

◆ print()

void print ( io::Output out)

Print the MD5 digest as an hexadecimal value.

References elm::io::hex(), elm::io::pad(), elm::io::right(), and elm::io::width().

Referenced by elm::checksum::operator<<().

◆ put() [1/5]

void put ( const cstring str)

Put a C string in the checksum.

Parameters
strC string to put in.

References String::chars(), String::length(), MD5::put(), and elm::str().

◆ put() [2/5]

void put ( const string str)

Put a string in the checksum.

Parameters
strString to put in.

References String::length(), MD5::put(), and elm::str().

◆ put() [3/5]

void put ( const void block,
t::uint32  length 
)

Put a data block in the checksum.

Parameters
blockBlock address.
lengthBlock length.

References elm::min().

Referenced by MD5::operator<<(), MD5::put(), and MD5::write().

◆ put() [4/5]

void put ( io::InStream in)

Put an input stream in the buffer. Read to the end of the stream.

Parameters
inInput stream to read.
Exceptions
io::IOExceptionIf there is an error during stream read.

◆ put() [5/5]

void put ( io::InStream in,
int  length 
)

Put at most length bytes from the given stream to compute the MD5 checksum.

Parameters
inInput stream to read.
lengthMaximum number of bytes to read.
Exceptions
io::IOExceptionIf there is an error during stream read.

References elm::min().

◆ write()

int write ( const char *  buffer,
int  size 
)
virtual

This is the main method of an output stream: the given buffer is put on the stream.

Parameters
bufferByte buffer to write.
sizeSize of the byte buffer.
Returns
Number of transferred bytes or less than 0 for an error.

Implements OutStream.

References MD5::put().

Member Data Documentation

◆ A

◆ B

◆ C

◆ D


The documentation for this class was generated from the following files: