[objc] view plaincopyprint?在CODE上查看代码片派生到我的代码片 <pre code_snippet_id="346208" snippet_file_name="blog_20140515_1_2220869" name="code" class="cpp">- (NSString *)hmacsha1:(NSString *)text key:(NSString *)secret { NSData *secretData = [secret dataUsingEncoding:NSUTF8StringEncoding]; NSData *clearTextData = [text dataUsingEncoding:NSUTF8StringEncoding]; unsigned char result[20]; CCHmac(kCCHmacAlgSHA1, [secretData bytes], [secretData length], [clearTextData bytes], [clearTextData length], result); char base64Result[32]; size_t theResultLength = 32; Base64EncodeData(result, 20, base64Result, &theResultLength); NSData *theData = [NSData dataWithBytes:base64Result length:theResultLength]; NSString *base64EncodedResult = [[NSString alloc] initWithData:theData encoding:NSASCIIStringEncoding]; return base64EncodedResult; }</pre><br> <br> <pre></pre>
ios项目开发(天气预报项目):使用正则获取 weather.com.cn网站信息,布布扣,bubuko.com
ios项目开发(天气预报项目):使用正则获取 weather.com.cn网站信息
原文:http://cocos2dxxx.blog.51cto.com/8810900/1413073