Implementation of information digest algorithm on Symbian OS V9 (MD5/sha1)

Source: Internet
Author: User
In security-related applications, we usually use digital signature technology, and most of them are implemented through MD5 or sha1 information digest algorithms, series 60 2nd and earlier versions have not published this API. We can only transplant it according to the C Language Algorithm in the RFC document. Of course, it is not difficult to transplant it. the release of Symbian OS V9 makes things easier. It discloses some security APIs. The following uses digest 5 as an example to show how to digest MD5 information:

Void getmsgdigestbymd5l (tdes8 & adest, const tdesc8 & asrc) {_ lit8 (kdigestformat, "% 02x"); adest. zero (); required 5 * MD5 = required 5: newl (); cleanupstack: pushl (MD5); tptrc8 ptrhash = MD5-> Hash (asrc ); for (tint I = 0; I <ptrhash. length (); I ++) {adest. appendformat (kdigestformat, ptrhash [I]);} cleanupstack: popanddestroy (MD5);} the MD5 information digest function is completed in just a few lines of code, it is really easy :) of course, we can also use limit 5: Update () to continuously add information content to implement the information summarization function for a large amount of data. when using objective 5, we need to include the header file hash. h, and need to link hash. lib. In addition, the sha1 implementation method is similar to the above. You only need to replace Objective 5 with the csha1 class.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.