×
Namespaces

Variants
Actions

SHA1

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: rathodavinash (24 May 2007)
Last edited: hamishwillee (26 Jul 2012)

Implementing SHA1 hashing is quiet easy on S60 2nd Edition devices.

You will need the SHA1 cpp sources from http://mikie.iki.fi/lxr/source/ContextNetwork/src/SHA1.cpp

Once you have SHA1.h and SHA1.cpp

Just write a function

TBuf8<150> iDigest;
iDigest.Copy(iPassword);
 
SHA1 * sha1 = new SHA1;
sha1->Input((char*)(iDigest.Ptr()),iDigest.Size());
unsigned int message_digest_array[5];
 
sha1->Result(message_digest_array);
 
TBuf<150> digest;
for (int i=0;i<5;i++)
{
TBuf<8> h;
h.Format(_L("%08x"),message_digest_array[i]);
digest.Append(h);
}
delete sha1;
 
iShaPass.Copy(digest);

Thats it you now have your SHA1'ed password in iShaPass.

This page was last modified on 26 July 2012, at 09:37.
24 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×