검색결과 리스트
objective c에 해당되는 글 1건
- 2011.03.03 HMAC-SHA1 구현
글
HMAC-SHA1 구현
Objective-C
2011. 3. 3. 23:37
@interface NSData (ATOAuth) - (NSData*)dataByHmacSHA1EncryptingWithKey:(NSData*)key; @end
#import "NSData+EOUtil.h"
#include <commoncrypto/commonhmac.h>
@implementation NSData (ATOAuth)
- (NSData*)dataByHmacSHA1EncryptingWithKey:(NSData*)key
{
void* buffer = malloc(CC_SHA1_DIGEST_LENGTH);
CCHmac(kCCHmacAlgSHA1, [key bytes], [key length], [self bytes], [self length], buffer);
return [NSData dataWithBytesNoCopy:buffer length:CC_SHA1_DIGEST_LENGTH freeWhenDone:YES];
}
@end
'Objective-C' 카테고리의 다른 글
| Objective-C 문자열 조작 메서드 (0) | 2011.04.29 |
|---|---|
| 다중인자를 갖는 PerformSelector 메시지 (0) | 2011.03.23 |
| Protocol 과 Category (0) | 2011.03.22 |
| Objective-C 훑어보기 (2) | 2011.03.20 |
| [Cocoa] Cocoa Design Pattern (0) | 2011.03.20 |
| HMAC-SHA1 구현 (0) | 2011.03.03 |