MD5 Class Reference

#include <md5.h>

Inheritance diagram for MD5:

Inheritance graph
Collaboration diagram for MD5:

Collaboration graph

Detailed Description

Implementation of the RFC 1321 MD5 message digest.

Usage flow:
  MD5()     // construct new MD5 object
  add()     // call as many times as necessary to process data
  final()   // finalize message digest computation
  result()  // get 128-bit message digest value

Recommendations for strict FIPS 140-1 compliance:
  MD5 is not a FIPS approved algorithm, so the MD5 class should
  *NOT* be used.

Sample code illustrating the use of this class appears in the Cookbook section Using the Message Digest Functions.

References

MD5 is specified in RFC1321.


Public Member Functions

 MD5 (int v=0)
 Constructor. Calls clear().
 ~MD5 ()
 Destructor. Calls clear().
int add (int count, const char *buf)
 Update the message digest computation with the contents of the input buffer.
int final (void)
 Finalize the message digest computation.
const char * result () const
 Get a pointer to the 16-byte message digest value.
int length () const
 Get the length of an MD5 value in bytes.
int blocksize () const
 Get the block size of the MD5 algorithm in bytes.
template<class T>
to () const
 Convert the message digest to type T.
str tostr () const
 Convert the message digest to a str:.
void clear (void)
 Clear MD5 object.


Constructor & Destructor Documentation

MD5 ( int  v = 0  )  [inline]

Constructor. Calls clear().

Parameters:
v unused; facilitates the use of templates elsewhere.
Remarks:
Modifies: state, cksum, and data are zeroized.

~MD5 (  )  [inline]

Destructor. Calls clear().

Remarks:
Modifies: state, cksum, and data are zeroized.


Member Function Documentation

int add ( int  count,
const char *  buf 
)

Update the message digest computation with the contents of the input buffer.

Parameters:
count length of input buffer in bytes
buf pointer to input buffer
Remarks:
Updates internal MD5 value.
Returns:
0 (success)
CDK_INVALID_PTR

int blocksize (  )  const [inline]

Get the block size of the MD5 algorithm in bytes.

Returns:
4 * MD5_BLOCK (64)

void clear ( void   ) 

Clear MD5 object.

Remarks:
Modifies: The object is reset to the initial state (MD5_Init is called).

int final ( void   ) 

Finalize the message digest computation.

Remarks:
Performs finalization step and sets internal state to FINAL.
Returns:
0 (success)
CDK_ERROR_STATE

int length (  )  const [inline]

Get the length of an MD5 value in bytes.

Returns:
MD5_LENGTH (16)

const char* result (  )  const

Get a pointer to the 16-byte message digest value.

Returns:
a pointer to the final message digest NULL (if the CDK is in an error state)

T to (  )  const [inline]

Convert the message digest to type T.

Returns:
a class T representation of the message digest value.

str tostr (  )  const

Convert the message digest to a str:.

Returns:
a string representation of the message digest value.


The documentation for this class was generated from the following file:
ISC Cryptographic Development Kit - User's Guide
ISC website
Questions? E-mail ISC technical support
Copyright© 2002-2006 Information Security Corp. All rights reserved.