Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to use the Hash API (pre-v9.5)

[Top]


How do I use the hash framework?

There are a couple of ways to interact with the hash framework. The following example is probably the most common:

 
_LIT(messagePart1, "Hello ");
_LIT(messagePart2, "My "); 
_LIT(messagePart3, "Name "); 
_LIT(messagePart4, "is Fred"); 
TBuf8<20> hash;

CSHA1* sha1 = CSHA1::NewL(); 
sha1->Update(messagePart1);
sha1->Update(messagePart2); 
sha1->Update(messagePart3);
hash.Copy(sha1->Final(messagePart4)); 

Note that Final() has a version that takes no data parameter which may be useful in certain situations.

A few pointers:

[Top]


Which hash should I use?

Unless you have a specific need to support certain hashes, use SHA-1.