CMessageDigest Class Reference

#include <hash.h>

Link against: hash.lib

class CMessageDigest : public CBase

Inherits from

Public Member Enumerations
enumTHashId { EMD2, EMD5, ESHA1, HMAC, ..., ESHA512 }
Public Member Functions
~CMessageDigest(void)
pure virtual IMPORT_C TIntBlockSize(void)
pure virtual IMPORT_C CMessageDigest *CopyL(void)
pure virtual IMPORT_C TPtrC8Final(const TDesC8 &)
pure virtual IMPORT_C TPtrC8Final(void)
TInt GetExtension(TUint, TAny *&, TAny *)
pure virtual IMPORT_C TPtrC8Hash(const TDesC8 &)
pure virtual IMPORT_C TIntHashSize(void)
pure virtual IMPORT_C CMessageDigest *ReplicateL(void)
pure virtual IMPORT_C voidReset(void)
pure virtual voidRestoreState()
pure virtual voidStoreState()
pure virtual IMPORT_C voidUpdate(const TDesC8 &)
Protected Member Functions
CMessageDigest(void)
CMessageDigest(const CMessageDigest &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()

Detailed Description

Base class for message digests.

Member Enumeration Documentation

Enum THashId

Enumeration to identify hash functions (aka message-digest algorithms).

EnumeratorValueDescription
EMD2

Message Digest algorithm developed by Rivest for digital signature applications (and optimized for 8-bit machines).

Takes a message of arbitrary length and produces a 128-bit message digest.

See RFC 1319

EMD5

Message Digest algorithm developed by Rivest for digital signature applications (and optimized for 32-bit machines).

Takes a message of arbitrary length and produces a 128-bit message digest.

See RFC 1321

ESHA1

Secure Hash Algorithm (version 1) is a message digest algorithm developed by NIST, along with the NSA, for use with the Digital Signature Standard (DSS).

It takes a message of less than 2^64 bits in length and produces a 160-bit message digest.

See FIPS 180-1 and RFC 3174

HMAC

HMAC - Hash function based Message Authentication Code is a mechanism for message authentication using cryptographic hash functions. (A checksum.)

It can be used with any iterative cryptographic hash function, e.g., MD5, SHA-1, in combination with a secret shared key to produce a checksum that is appended to the message. The cryptographic strength of HMAC depends on the properties of the underlying hash function.

See RFC 2104

EMD4

Message Digest algorithm developed by Rivest for digital signature applications (and optimized for 32-bit machines).

Takes a message of arbitrary length and produces a 128-bit message digest.

See RFC 1320

ESHA224

Secure Hash Algorithm - 224 (version 2) is a message digest algorithm developed by NIST, along with the NSA, for use with the Digital Signature Standard (DSS).

It takes a message of less than 2^64 bits in length and produces a 224-bit message digest.

See FIPS 180-2 (with change notice), RFC3874 and FIPS 180-3

ESHA256

Secure Hash Algorithm - 256 (version 2) is a message digest algorithm developed by NIST, along with the NSA, for use with the Digital Signature Standard (DSS).

It takes a message of less than 2^64 bits in length and produces a 256-bit message digest.

See FIPS 180-2 and RFC 4634

ESHA384

Secure Hash Algorithm - 384 (version 2) is a message digest algorithm developed by NIST, along with the NSA, for use with the Digital Signature Standard (DSS).

It takes a message of less than 2^128 bits in length and produces a 384-bit message digest.

See FIPS 180-2 and RFC 4634

ESHA512

Secure Hash Algorithm - 512 (version 2) is a message digest algorithm developed by NIST, along with the NSA, for use with the Digital Signature Standard (DSS).

It takes a message of less than 2^128 bits in length and produces a 512-bit message digest.

See FIPS 180-2 and RFC 4634

Constructor & Destructor Documentation

CMessageDigest ( void )

IMPORT_CCMessageDigest(void)[protected]

Constructor

CMessageDigest ( const CMessageDigest & )

IMPORT_CCMessageDigest(const CMessageDigest &aMD)[protected]

Copy constructor

Parameters
aMDA CMessageDigest object

~CMessageDigest ( void )

IMPORT_C~CMessageDigest(void)

Destructor.

Member Function Documentation

BlockSize ( void )

IMPORT_C TIntBlockSize(void)[pure virtual]

Gets the internal block size of the message digest.

Return Value
Internal block size of message digest in bytes.

CopyL ( void )

IMPORT_C CMessageDigest *CopyL(void)[pure virtual]

Creates a new CMessageDigest object with the exact same state as the current object.

This function copies all internal state of the message digest. To create a new CMessageDigest object without the state of the current object, see ReplicateL().

Return Value
A pointer to the new CMessageDigest object

Final ( const TDesC8 & )

IMPORT_C TPtrC8Final(const TDesC8 &aMessage)[pure virtual]

Adds aMessage to the internal representation of data to be hashed, returns a TPtrC8 of the finalised hash of all the previously appended messages, and calls Reset().

Since
v8.0
Parameters
aMessageData to be included in the hash
Return Value
A descriptor pointer to the buffer containing the resulting hash.

Final ( void )

IMPORT_C TPtrC8Final(void)[pure virtual]

Gets a TPtrC8 of the finalised hash of all the previously appended messages and then calls Reset().

Since
v8.0
Return Value
A descriptor pointer to the buffer containing the resulting hash.

GetExtension ( TUint, TAny *&, TAny * )

TInt GetExtension(TUintaExtensionId,
TAny *&a0,
TAny *a1
)

Used to retrieve the extended interfaces extension

Hash ( const TDesC8 & )

IMPORT_C TPtrC8Hash(const TDesC8 &aMessage)[pure virtual]

Adds aMessage to the internal representation of data to be hashed, then returns a TPtrC8 of the finalised hash of all the previously appended messages.

Parameters
aMessageData to be included in the hash.
Return Value
A descriptor pointer to the buffer containing the resulting hash.

HashSize ( void )

IMPORT_C TIntHashSize(void)[pure virtual]

Gets the size of the message digest output.

Return Value
Output size of the message digest in bytes.

ReplicateL ( void )

IMPORT_C CMessageDigest *ReplicateL(void)[pure virtual]

Creates a brand new reset CMessageDigest object containing no state information from the current object.

To make a copy of a message digest with its internal state intact, see CopyL().

Return Value
A pointer to the new reset CMessageDigest object

Reset ( void )

IMPORT_C voidReset(void)[pure virtual]

Resets the internal state of the message digest.

A reset hash object loses all internal state representing the hashed data. A reset message digest is suitable to begin a new, distinct hash of different data. Any previously returned TPtrC8 from a call to Final() remains valid until any subsequent call to Update() or Final().

RestoreState ( )

voidRestoreState()[pure virtual]

Restores the internal state of the message digest to a previously stored state.

See also: StoreState()

StoreState ( )

voidStoreState()[pure virtual]

Stores the internal state of the message digest.

Update ( const TDesC8 & )

IMPORT_C voidUpdate(const TDesC8 &aMessage)[pure virtual]

Adds data to the internal representation of messages to be hashed.

Since
v8.0
Parameters
aMessageData to be included in the hash.