MD2 Class Reference

#include <md2.h>

Inheritance diagram for MD2:

Inheritance graph
Collaboration diagram for MD2:

Collaboration graph

Detailed Description

Implementation of the RFC 1319 MD2 message digest.

Usage flow:
  MD2()     // construct new MD2 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:
  MD2 is not a FIPS approved algorithm, so the MD2 class should
  *NOT* be used.

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

References

MD2 is specified in RFC1319.


Public Member Functions

 MD2 (int v=0)
 Constructor. Calls clear().
 ~MD2 ()
 Destructor. Calls clear().
int add (int count, const char *buf)
 Update message digest computation with contents of 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 MD2 value in bytes.
int blocksize () const
 Get the block size of the MD2 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 MD2 object.


Constructor & Destructor Documentation

MD2 ( int  v = 0  )  [inline]

Constructor. Calls clear().

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

~MD2 (  )  [inline]

Destructor. Calls clear().

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


Member Function Documentation

int add ( int  count,
const char *  buf 
)

Update message digest computation with contents of input buffer.

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

int blocksize (  )  const [inline]

Get the block size of the MD2 algorithm in bytes.

Returns:
4 * MD2_BLOCK (64)

void clear ( void   ) 

Clear MD2 object.

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

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 MD2 value in bytes.

Returns:
MD2_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.