Skip to content

Instantly share code, notes, and snippets.

@samdmarshall
Created March 29, 2013 19:14
Show Gist options
  • Select an option

  • Save samdmarshall/5272941 to your computer and use it in GitHub Desktop.

Select an option

Save samdmarshall/5272941 to your computer and use it in GitHub Desktop.
static inline NSData* SHA1HashOfFileAtPath(NSString *path) {
unsigned char hashBytes[CC_SHA1_DIGEST_LENGTH];
NSData *fileData = [NSData dataWithContentsOfFile:path]
CC_SHA1([fileData bytes], [fileData length], hashBytes);
return [NSData dataWithBytes:hashBytes length:CC_SHA1_DIGEST_LENGTH];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment