Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SHA1
- #import <CommonCrypto/CommonDigest.h>
- - (NSString*)getSHA1WithString:(NSString*)string
- {
- NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
- uint8_t digest[CC_SHA1_DIGEST_LENGTH];
- CC_SHA1(data.bytes, (CC_LONG)data.length, digest);
- NSMutableString *output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
- for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
- {
- [output appendFormat:@"%02x", digest[i]];
- }
- return output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement