MD5 Class Reference

Computes the MD5 checksum from a byte stream. More...

#include <md5.hpp>

Inheritance diagram for MD5:

Checksum List of all members.

Public Member Functions

 MD5 ()
 Default constructor.
void reset ()
 Resets the MD5 checksum to initial state of computation.
void * getValue (void *buffer) const
 Returns the MD5 checksum value in the first 16 bytes of the given adress.
wxString getValue (const bool hexInUpperCase=false) const
 Returns the MD5 checksum value in a string.
void update (const wxByte *buf, unsigned int len)
 Updates the MD5 checksum with specified array of bytes.

Protected Member Functions

void finish ()
 Process the remaining bytes in the internal buffer and the usual prolog according to the standard.
void process_block (const void *buf, size_t len)
 Process len bytes of buf, accumulating context in this.

Protected Attributes

wxUint32 A_
 First part of the state of computation.
wxUint32 B_
 Second part of the state of computation.
wxUint32 C_
 Third part of the state of computation.
wxUint32 D_
 Fourth part of the state of computation.
wxUint32 total [2]
 Number of bits mod 2^64.
wxUint32 buflen
 Current size of the input buffer.
wxByte ibuffer [128]
 Input buffer.

Static Protected Attributes

static const wxByte fillbuf [64]
 The bytes used to pad the buffer to the next 64-byte boundary (RFC 1321, 3.1: Step 1).

Detailed Description

Computes the MD5 checksum from a byte stream.

This class is a rewrite in C++ of the md5 checksum computing algorithm present in the GNU coreutils. Please see the GNU projet website for more informations.

Using this class in very simple:
Use the update method to provide to the class the bytes for computing the checksum.

The MD5 checksum value can be gotten by two ways:

The MD5 checksum computing can be reseted by the reset method.


Member Function Documentation

wxString MD5::getValue const bool  hexInUpperCase = false  )  const [virtual]
 

Returns the MD5 checksum value in a string.

Parameters:
hexInUpperCase If true the hexadecimal letters will be in uppercase.
Returns:
The current checksum value.

Implements Checksum.

void * MD5::getValue void *  buffer  )  const
 

Returns the MD5 checksum value in the first 16 bytes of the given adress.

Parameters:
buffer The buffer where the MD5 checksum value will be stored.
Returns:
The adress of the buffer.
Remarks:
On some systems it is required that buffer is correctly aligned for a 32 bits value.

The memory for the 16 bytes must have been allocated before calling this method.

void MD5::process_block const void *  buf,
size_t  len
[protected]
 

Process len bytes of buf, accumulating context in this.

It is assumed that len % 64 == 0.

Parameters:
buf The buffer to process.
len The number of bytes to process.

void MD5::update const wxByte *  buf,
unsigned int  len
[virtual]
 

Updates the MD5 checksum with specified array of bytes.

Parameters:
buf The byte array to update the MD5 checksum with.
len The number of bytes to use for the update.

Implements Checksum.


Member Data Documentation

const wxByte MD5::fillbuf [static, protected]
 

Initial value:

 {
  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
The bytes used to pad the buffer to the next 64-byte boundary (RFC 1321, 3.1: Step 1).


The documentation for this class was generated from the following files:
Generated on Mon Feb 20 11:06:41 2006 for wxFlickr by  doxygen 1.4.6-NO