Skip to content

Instantly share code, notes, and snippets.

@kristopherjohnson
Created April 30, 2012 23:39
Show Gist options
  • Save kristopherjohnson/2563667 to your computer and use it in GitHub Desktop.
Save kristopherjohnson/2563667 to your computer and use it in GitHub Desktop.
Generate SHA1 hash for a string
#import <CommonCrypto/CommonDigest.h>
// ...
const char *unlockCode = "99999999";
size_t unlockCodeSize = strlen(unlockCode);
unsigned char hashBytes[CC_SHA1_DIGEST_LENGTH];
CC_SHA1(unlockCode, unlockCodeSize, hashBytes);
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment