Here's an Objective C method that'll return a SHA512 hex of a given string:
const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding]; uint8_t digest[CC_SHA512_DIGEST_LENGTH]; CC_SHA512(data.bytes, data.length, digest); for(int i = 0; i < CC_SHA512_DIGEST_LENGTH; i++) [output appendFormat:@"%02x", digest[i]]; return output; }
You'll need to include:
#include <CommonCrypto/CommonDigest.h>