I'm using the following function for SHA1 hash from NSString in my application:
-(NSString *)stringToSha1:(NSString *)str{
const char *cstr = [str cStringUsingEncoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithBytes:cstr length:str.length];
uint8_t digest[CC_SHA1_DIGEST_LENGTH];
CC_SHA1(data.bytes, data.length, digest);
NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}
This works like a charm on my iphone devices with ios 5.0 and up, but on my iPad running version 4.3.5 it crashes on the line
CC_SHA1(data.bytes, data.length, digest);
It says the following:
dyld: lazy symbol binding failed: can't resolve symbol _CC_SHA1 in because dependent dylib #3 could not be loaded
dyld: can't resolve symbol _CC_SHA1 in because dependent dylib #3 could not be loaded
Any ideas on how to make it work on my iPad 4.3.5 device?