views:

515

answers:

2

hi all, 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.

+2  A: 

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.

Frank Shearar
Thanks frank,I only include #import <CommonCrypto/CommonDigest.h> . Now it works great. Now only one problem is pendingNSString *hash = [HMAC base64Encoding];This statement give warningwarning: 'NSData' may not respond to '-base64Encoding'Please suggest
Rupesh