cxxtools::Md5stream Class Reference

This is a easy and safe interface to MD5-calculation. More...

#include <cxxtools/md5stream.h>

Public Types

typedef
std::ostreambuf_iterator< char > 
iterator

Public Member Functions

 Md5stream ()
 initializes md5-calculation
void getDigest (unsigned char digest[16])
 ends md5-calculation and returns 16 bytes digest
const char * getHexDigest ()
 ends md5-calculation and digest as 32 bytes hex
iterator begin ()
 returns output-iterator to Md5stream

Detailed Description

This is a easy and safe interface to MD5-calculation.

To get a MD5-sum of data, instantiate a md5stream, copy your data into it and read the digest.

After calling getDigest or getHexDigest, the class can be reused for another md5-calculation. The algorithm is automatically reinitialized when the first character is received.

example:

int main(int argc, char* argv[])
{
for (int i = 1; i < argc; ++i)
{
std::ifstream in(argv[i]);
if (in)
{
s << in.rdbuf();
std::cout << s.getHexDigest() << " " << argv[i] << std::endl;
}
}
}

Member Typedef Documentation

typedef std::ostreambuf_iterator<char> cxxtools::Md5stream::iterator

Constructor & Destructor Documentation

cxxtools::Md5stream::Md5stream ( )
inline

initializes md5-calculation

Member Function Documentation

iterator cxxtools::Md5stream::begin ( )
inline

returns output-iterator to Md5stream

void cxxtools::Md5stream::getDigest ( unsigned char  digest[16])
inline

ends md5-calculation and returns 16 bytes digest

const char* cxxtools::Md5stream::getHexDigest ( )

ends md5-calculation and digest as 32 bytes hex


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