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.