Humble Framework for SkyOS


Main Page | Modules | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

HMD5 Class Reference
[Abstract Data Types]

#include <HMD5.h>

Inheritance diagram for HMD5:

HObj

Detailed Description

The HMD5 class can generate a 128-bit MD5 hash value for any arbitrary-sized block of data. There are two ways in which the hash value can be generated:

Definition at line 77 of file HMD5.h.

Public Types

typedef uint8 Digest [kDigestLen]
enum  { kInputLen = 64, kDigestLen = 16 }

Public Member Functions

ErrCode Start (void)
 Resets the MD5 digest to it's initial state.
ErrCode Stop (void)
 Terminates the message-digest computation.
ErrCode Update (PtrConst pData, uint32 uBytes)
 Updates the message digest.
void GetDigest (HMD5::Digest &digest) const
 Returns the digest.
StringPtr GetDigestStr (const bool bUppercase=true) const
 Returns the digest as a string.
bool operator== (const HMD5 &rhs) const
bool operator!= (const HMD5 &rhs) const

Static Public Member Functions

static ErrCode Compute (PtrConst pData, uint32 uBytes, HMD5::Digest &digest)
 Computes an MD5 Digest.
static ErrCode ConvertToDigest (StringPtr pstr, HMD5::Digest &digest)
 Converts string version of an MD5 Hash value into it's binary equivalent.
static StringPtr ConvertToString (const HMD5::Digest &digest, const bool bAllCaps=true)
 Creates a human-readable version of the MD5 Hash value.
static int32 Compare (const HMD5::Digest &lhs, const HMD5::Digest &rhs)
 Compares two digests.
static int32 Compare (const HMD5::Digest &digest, StringPtr pstrDigest)
 Compares a digest to a string.

Data Fields

enum HMD5:: { ... }  bogus

Protected Member Functions

void transform (const uint32 uScratch[])
 Transforms the input buffer.

Protected Attributes

Digest m_digest
 Current digest in binary form.
uint32 m_uBits [2]
 Number of bits handled mod 2^64.
uint32 m_uBuffer [4]
 Number of bits handled mod 2^64 Persistent Scratch buffer.
uint8 m_cInput [kInputLen]
 Input buffer.


Member Function Documentation

static ErrCode HMD5::Compute PtrConst  pData,
uint32  uBytes,
HMD5::Digest &  digest
[static]
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
pData Ptr to data
uBytes Data length (in bytes)
[out] digest Digest

Definition at line 117 of file HMD5.h.

static ErrCode HMD5::ConvertToDigest StringPtr  pstr,
HMD5::Digest &  digest
[static]
 

Returns:
NO_ERROR on success, error code otherwise
Parameters:
pstr Ptr to string
[out] digest MD5 digest

Definition at line 143 of file HMD5.h.

static StringPtr HMD5::ConvertToString const HMD5::Digest &  digest,
const bool  bAllCaps = true
[static]
 

Converts the binary digest to a human readable hexadecimal string.

Returns:
Ptr to digest as a string
Parameters:
digest HMD5 digest
bAllCaps True for uppercase, false for lowercase
Warning:
The result string is destroyed each time this method is called.

Definition at line 185 of file HMD5.h.

ErrCode HMD5::Start void   ) 
 

Returns:
Always NO_ERROR

Definition at line 211 of file HMD5.h.

ErrCode HMD5::Stop void   ) 
 

This methods terminates the message-digest computation and ends with the desired message digest in m_digest[0...15].

Returns:
NO_ERROR on success, error code otherwise

Definition at line 233 of file HMD5.h.

ErrCode HMD5::Update PtrConst  pData,
uint32  uBytes
 

Updates the message-digest context to account for the presence of each of the characters pc[0..uBytes - 1] in the message whose digest is being computed. Note that the data ptr can be NULL if--and only if--the data size is also zero.

Returns:
NO_ERROR on success, error code otherwise
Parameters:
pData Ptr to data
uBytes Size of data (in bytes)

Definition at line 300 of file HMD5.h.

void HMD5::transform const uint32  uScratch[]  )  [protected]
 

Parameters:
uScratch Array of scratch data to transform against

Definition at line 354 of file HMD5.h.

void HMD5::GetDigest HMD5::Digest &  digest  )  const
 

Parameters:
[out] digest Computed MD5 digest value

Definition at line 499 of file HMD5.h.

StringPtr HMD5::GetDigestStr const bool  bUppercase = true  )  const
 

This method converts the binary digest into a hexidecimal text string that is human-readable.

Returns:
Ptr to string
Parameters:
bUppercase True for uppercase, false otherwise.
See also:
ConvertToString()

Definition at line 511 of file HMD5.h.

static int32 HMD5::Compare const HMD5::Digest &  lhs,
const HMD5::Digest &  rhs
[static]
 

Returns:
0 if equal, <0 if LHS is smaller, or >0 if RHS is smaller
Parameters:
lhs Left hand digest
rhs Right hand digest

Definition at line 522 of file HMD5.h.

static int32 HMD5::Compare const HMD5::Digest &  digest,
StringPtr  pstrDigest
[static]
 

Returns:
0 if equal, <0 if LHS is smaller, or >0 if RHS is smaller
Parameters:
digest Digest
pstrDigest Ptr to string

Definition at line 529 of file HMD5.h.


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

2006.01.09-16:37