#import <CommonCrypto/CommonDigest.h>
...
NSString *secretCookie = @"lksab8xd7FdjdsD3"; // CHANGE ME!!
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
long timestamp = (long)(timeInterval * 1000);
int hashSize = 20;
unsigned char hashedChars[hashSize];
NSString *strToHash = [NSString stringWithFormat:@"%@%@%d%d", username, secretCookie, score, timestamp];
CC_SHA1([strToHash UTF8String],
[strToHash lengthOfBytesUsingEncoding:NSUTF8StringEncoding], hashedChars);
NSMutableString *hashedString = [[[NSMutableString alloc] init] autorelease];
for (int i=0; i<hashSize; i++) {
[hashedString appendFormat:@"%02x", hashedChars[i]];
}