문제

i want to generate HMAC-SHA1 of NSString type variable. I see the post but this method give me error in CCHmac(kCCHmacAlgSHA256, cKey, strlen(cKey), cData, strlen(cData), cHMAC);

and

NSString *hash = [HMAC base64Encoding]; line.

Please suggest how can I generate the HMAC-SHA1 of any string.

도움이 되었습니까?

해결책

Have you got this at the top of your source file?

#import <CommonCrypto/CommonHMAC.h>

Regarding the base64 part of your question, this question will show you where to get a base64 encoding library/protocol.

다른 팁

About the base64Encoding problem: This is because NSData does not contains this method by default, you need to extend NSData with that. In this link is explained http://cocoawithlove.com/2009/06/base64-encoding-options-on-mac-and.html good luck!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top