I am building an iPhone app and stick to the following:
unsigned char hashedChars[32]; CC_SHA256([inputString UTF8String], [inputString lengthOfBytesUsingEncoding:NSASCIIStringEncoding], hashedChars); NSData *hashedData = [NSData dataWithBytes:hashedChars length:32]; NSLog(@"hashedData = %@", hashedData);
The magazine shows how:
hashedData = <abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh abcdefgh>
- note hashedData is NSData, not NSString
But I need to convert hashedData to NSString, which looks like this:
NSString *someString = @"abcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefghabcdefgh";
So basically the result should be similar to hashedData, except that I don't need angle brackets and the spaces between them.
iphone nsstring nsdata
topace Apr 16 '10 at 13:38 2010-04-16 13:38
source share