Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

MD5 Class Reference

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

#include <md5.hpp>

Inheritance diagram for MD5:

Inheritance graph
[legend]
Collaboration diagram for MD5:

Collaboration graph
[legend]
List of all members.

Public Member Functions

wxString getValue (const bool hexInUpperCase=false) const
 Returns the MD5 checksum value in a string.

void * getValue (void *buffer) const
 Returns the MD5 checksum value in the first 16 bytes of the given adress.

 MD5 ()
 Default constructor.

void reset ()
 Resets the MD5 checksum to initial state of computation.

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 buflen
 Current size of the input buffer.

wxUint32 C_
 Third part of the state of computation.

wxUint32 D_
 Fourth part of the state of computation.

wxByte ibuffer [128]
 Input buffer.

wxUint32 total [2]
 Number of bits mod 2^64.


Static Protected Attributes

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:<BR> 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.

Definition at line 63 of file md5.hpp.


Constructor & Destructor Documentation

MD5::MD5  ) 
 

Default constructor.

Definition at line 61 of file md5.cpp.

References reset().


Member Function Documentation

void MD5::finish  )  [protected]
 

Process the remaining bytes in the internal buffer and the usual prolog according to the standard.

Definition at line 89 of file md5.cpp.

References buflen, fillbuf, ibuffer, process_block(), and total.

Referenced by getValue().

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.

Definition at line 377 of file md5.cpp.

References getValue().

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.

Definition at line 359 of file md5.cpp.

References A_, B_, C_, D_, finish(), and getValue().

Referenced by getValue().

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.

Definition at line 205 of file md5.cpp.

References A_, B_, C_, D_, FG, FH, FI, process_block(), and total.

Referenced by finish(), process_block(), and update().

void MD5::reset  )  [virtual]
 

Resets the MD5 checksum to initial state of computation.

Implements Checksum.

Definition at line 71 of file md5.cpp.

References A_, B_, buflen, C_, D_, and total.

Referenced by MD5().

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.

Definition at line 116 of file md5.cpp.

References buflen, ibuffer, process_block(), and update().

Referenced by update().


Member Data Documentation

wxUint32 MD5::A_ [protected]
 

First part of the state of computation.

Definition at line 73 of file md5.hpp.

Referenced by getValue(), process_block(), and reset().

wxUint32 MD5::B_ [protected]
 

Second part of the state of computation.

Definition at line 74 of file md5.hpp.

Referenced by getValue(), process_block(), and reset().

wxUint32 MD5::buflen [protected]
 

Current size of the input buffer.

Definition at line 79 of file md5.hpp.

Referenced by finish(), reset(), and update().

wxUint32 MD5::C_ [protected]
 

Third part of the state of computation.

Definition at line 75 of file md5.hpp.

Referenced by getValue(), process_block(), and reset().

wxUint32 MD5::D_ [protected]
 

Fourth part of the state of computation.

Definition at line 76 of file md5.hpp.

Referenced by getValue(), process_block(), and reset().

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).

Definition at line 51 of file md5.cpp.

Referenced by finish().

wxByte MD5::ibuffer[128] [protected]
 

Input buffer.

Definition at line 80 of file md5.hpp.

Referenced by finish(), and update().

wxUint32 MD5::total[2] [protected]
 

Number of bits mod 2^64.

Definition at line 78 of file md5.hpp.

Referenced by finish(), process_block(), and reset().


The documentation for this class was generated from the following files:
Generated on Sun May 30 13:38:05 2004 for wxChecksums by doxygen 1.3.7