IOS-MD5 encryption

Source: Internet
Author: User
<span id="Label3"></p><br><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important">#import</span></span><CommonCrypto/CommonDigest.h><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important">//</span></span><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important">need to import for CC_MD5 access</span></span><p style="margin:10px auto; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:24px"><p style="margin:10px auto; padding-top:0px; padding-bottom:0px; color:rgb(51,51,51); font-family:Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:24px"></p></p><span class="cnblogs_code_copy" style="margin:0px; padding:0px 5px 0px 0px; line-height:1.5!important"><span class="cnblogs_code_copy" style="margin:0px; padding:0px 5px 0px 0px; line-height:1.5!important"></span></span><span style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:24px; background-color:rgb(245,245,245)"><span style="font-family:Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:24px; background-color:rgb(245,245,245)"><span style="color:#33ff33">//string is MD5 encrypted, returning the encrypted string. </span></span></span><br>-(nsstring *) md5: (nsstring *) str<br style="margin:0px; padding:0px">{<br style="margin:0px; padding:0px"><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important">Const</span></span><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important">Char</span></span>*cstr = [str utf8string];<br style="margin:0px; padding:0px">Unsigned<span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important">Char</span></span>result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"></span> -</span>];<br style="margin:0px; padding:0px">CC_MD5 (cStr, strlen (cStr), result);<span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important">//</span></span><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important">the <span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important">MD5</span> call</span><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,128,0); line-height:1.5!important"><br style="margin:0px; padding:0px"></span></span><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(0,0,255); line-height:1.5!important">return</span></span>[nsstring stringwithformat:<br style="margin:0px; padding:0px"><span style="margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important">@"</span></span><span style="margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important">%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x</span></span><span style="margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,0); line-height:1.5!important">"</span></span>,<br style="margin:0px; padding:0px">result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">0</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">1</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">2</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">3</span></span>],<br style="margin:0px; padding:0px">result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">4</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">5</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">6</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">7</span></span>],<br style="margin:0px; padding:0px">result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">8</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">9</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important">Ten</span></span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"></span> one</span>],<br style="margin:0px; padding:0px">result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"></span> a</span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"></span> -</span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"></span> -</span>], result[<span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"><span style="margin:0px; padding:0px; color:rgb(128,0,128); line-height:1.5!important"></span> the</span>]<br style="margin:0px; padding:0px">];<br style="margin:0px; padding:0px">}<br><br><br><br><span style="color:rgb(51,51,51); font-family:Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:24px"><span style="color:rgb(51,51,51); font-family:Verdana,Arial,Helvetica,sans-serif; font-size:13px; line-height:24px">Online test MD5:</span></span>http://www.cmd5.com/<br> <p style="font-size:12px;"><p style="font-size:12px;">Copyright Notice: This article for Bo Master original article, without Bo Master permission not Reproduced.</p></p> <p><p>IOS-MD5 encryption</p></p></span>

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.