Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

SHA1

From 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 06:37.
44 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.

×