Objective-Cリハビリ中メモ。 環境: Xcode 4.6.3, iOS 6. Objective-Cで md5, sha1, sha2 を作ってみる。 md5 // md5 +(NSString *) md5WithString:(NSString *)input { const char *cStr = [input UTF8String]; unsigned char digest[16]; CC_MD5( cStr, strlen(cStr), digest ); NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2]; for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) [output appendFormat:@
![Objective-C事始め – md5, sha1, sha2を作りたい](https://cdn-ak-scissors.b.st-hatena.com/image/square/827bddfa9d702047ab37405dc37956f0d4683057/height=288;version=1;width=512/http%3A%2F%2Fwww.inazumatv.com%2Fcontents%2Fwp-content%2Fuploads%2F2013%2F08%2F9e1a3e51455f6388953028158e50767e.png)