#import <CommonCrypto/CommonDigest.h>
+(NSString*) hmac_sha1:(NSString*)input usingSecret:(NSString*)key
const char *cKey = [key UTF8String];
const char *cInput = [input UTF8String];
unsigned char digest[CC_SHA1_DIGEST_LENGTH];
if (cKey == nil || cInput == nil) {
NSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
CCHmac(kCCHmacAlgSHA1, cKey, strlen(cKey), cInput, strlen(cInput), digest);
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) {
[output appendFormat:@"%02x", digest[i]];