{"id":465,"date":"2014-11-11T17:58:38","date_gmt":"2014-11-11T09:58:38","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=465"},"modified":"2016-07-14T22:55:27","modified_gmt":"2016-07-14T14:55:27","slug":"ios%e5%bc%80%e5%8f%91%e4%b8%ad%e5%ad%97%e7%ac%a6%e4%b8%b2md5%e5%8a%a0%e5%af%86%e6%96%b9%e6%b3%95%e7%9a%84%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/11\/11\/175838465.html","title":{"rendered":"iOS\u5f00\u53d1\u4e2d\u5b57\u7b26\u4e32MD5\u52a0\u5bc6\u65b9\u6cd5\u7684\u5b9e\u73b0"},"content":{"rendered":"<pre lang=\"objc\" line=\"1\">- (NSString *) md5\n{\n    const char *cStr = [self UTF8String];\n    unsigned char result[16];\n    CC_MD5( cStr, (unsigned int) strlen(cStr), result);\n    return [NSString stringWithFormat:\n                        @\"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\",\n                        result[0], result[1], result[2], result[3], \n                        result[4], result[5], result[6], result[7],\n                        result[8], result[9], result[10], result[11],\n                        result[12], result[13], result[14], result[15]\n                        ];      \n}<\/pre>\n<p>\u8bb0\u5f97\u8981\u52a0\u4e0a\u5934\u6587\u4ef6#import &lt;CommonCrypto\/CommonDigest.h&gt;\u5426\u5219\u4f1a\u6709\u8b66\u544a<\/p>\n<p>\u9519\u8bef\u63d0\u793a\uff1aimplicit declaration of function &#8216;CC_MD5&#8217; is invalid in C99\uff0c\u8fd9\u4e2a\u9519\u8bef\u63d0\u793a\u7684\u539f\u56e0\u662f\u4f7f\u7528\u4e86c\u8bed\u8a00\u5e93\u7684CC_MD5\u51fd\u6570\u800c\u6ca1\u6709\u5305\u542b\u76f8\u5173\u7684\u5934\u6587\u4ef6\uff0c\u56e0\u6b64\u53ea\u9700\u8981\u5f15\u5165\u76f8\u5173\u5934\u6587\u4ef6\u5373\u53ef\u89e3\u9664\u8b66\u544a\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8211; (NSString *) md5 { const char *cStr = [self UTF8String]; unsigned char result[16]; CC_MD5( cStr, (unsigned int) strlen(cStr), result); return [NSString stringWithFormat: @&#8221;%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x&#8221;, result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7], result[8], result[9], result[10], result[11], result[12], result[13], result[14], result[15] ]; } \u8bb0\u5f97\u8981\u52a0\u4e0a\u5934\u6587\u4ef6#import &lt;CommonCrypto\/CommonDigest.h&gt;\u5426\u5219\u4f1a\u6709\u8b66\u544a \u9519\u8bef\u63d0\u793a\uff1aimplicit declaration of function &#8216;CC_MD5&#8217; is invalid in C99\uff0c\u8fd9\u4e2a\u9519\u8bef\u63d0\u793a\u7684\u539f\u56e0\u662f\u4f7f\u7528\u4e86c\u8bed\u8a00\u5e93\u7684CC_MD5\u51fd\u6570\u800c\u6ca1\u6709\u5305\u542b\u76f8\u5173\u7684\u5934\u6587\u4ef6\uff0c\u56e0\u6b64\u53ea\u9700\u8981\u5f15\u5165\u76f8\u5173\u5934\u6587\u4ef6\u5373\u53ef\u89e3\u9664\u8b66\u544a\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[15,17],"class_list":["post-465","post","type-post","status-publish","format-standard","hentry","category-project","tag-module","tag-skill"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/465","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=465"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/465\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}