以下は、基本クラスとしてiOS5で問題なく動作しましたが、iOS6では失敗します(SIGABRT)。それはOSのものなのか、それともアーキテクチャーなものなのか?
また、付随するMD5ハッシュが機能することにも注意してください。
-(NSString *)SHA1Hash {
const char *cStr = [self UTF8String];
unsigned char digest[16];
CC_SHA1( cStr, strlen(cStr), digest ); // This is the sha1 call
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;
}
助けてくれてありがとう!