'objective-C'에 해당되는 글 3건

  1. 2009/06/24 아이폰 SDK - md5
  2. 2009/06/23 NSString 문자열 길이를 UNICODE byte크기로 알아내기!!
  3. 2007/08/14 MAC 관련 사이트 모음
검색하다가 발견!!
잘 되려나??

일단 백업해둠



TUESDAY, JULY 22, 2008

MD5 hash on iPhone with cocoa and Objective-C

In beta 7 OpenSSL has been removed from the iPhone SDK. However, MD5 is still available.

Simply import CommonCrypto as follows:
#import < CommonCrypto/CommonDigest.h >

Then add this C function to your objective-c class between the @implementation and @end statements (if you like).

NSString* md5( NSString *str )
{
const char *cStr = [str UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5( cStr, strlen(cStr), result );
return [NSString stringWithFormat:
@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
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]
];
}

I am sure you can just use NSData for this but this is the way an example was posted on apple forums. Please feel free to add an NSData based solution.

Read the post here "http://discussions.apple.com/thread.jspa?threadID=1509152&tstart=96"
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2009/06/24 11:08 2009/06/24 11:08

-- 백업 -- 백업 -- 백업 -- 백업 -- 백업 -- 백업 -- 백업 -- 백업 --


NSString *temp = @"test";


printf("%d\n",[temp lengthOfBytesUsingEncoding:NSUnicodeStringEncoding]);


결과는!!


8


-_-b


유니코드로 인코딩해서 strlen으로 변환 하는 뻘짓을 햇다가 안되길래


찾아보니 잇슴.. OTL..


결론은 lengthOfBytesUsingEncoding:

크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2009/06/23 15:08 2009/06/23 15:08
Xcode, Cocoa, 맥 프로그래밍 관련 국내외 사이트
http://cocoadev.tistory.com/8  

키스맥
http://www.kissmac.com/  

맥마당
http://www.macmadang.com/  

withMAC
http://www.withmac.com/

Apple - Mac OS X - Java
http://www.apple.com/macosx/features/java/  

Apple - Cocoa
http://developer.apple.com/cocoa/  

Appe - Xcode
http://www.apple.com/kr/macosx/features/xcode/  

Apple - Developing Dashboard Widgets
http://developer.apple.com/macosx/dashboard.html  

Apple - Introduction to The Objective-C Programming Language
http://developer.apple.com/documentatio ··· n_1.html
크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)
2007/08/14 16:17 2007/08/14 16:17