Skip to content

Instantly share code, notes, and snippets.

@craigw
Forked from ezodude/NSString+SO.m
Last active August 29, 2015 14:01
Show Gist options
  • Save craigw/ce1e3d71646292a822d9 to your computer and use it in GitHub Desktop.
Save craigw/ce1e3d71646292a822d9 to your computer and use it in GitHub Desktop.
- (uint8_t *)SHA256;
//
// Created by Ezo Saleh on 04/12/2011.
// Any bugs added by Craig :)
//
#import "sha256.h"
-(uint8_t *) SHA256{
const char *cstr = [self cStringUsingEncoding:NSUTF8StringEncoding];
NSData *data = [NSData dataWithBytes:cstr length:self.length];
uint8_t digest[CC_SHA256_DIGEST_LENGTH];
CC_SHA256(data.bytes, data.length, digest);
return digest;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment