Re: How to encrypt a String to a SHA-1 Encrypted in iPhone

2010-11-28 Thread Keith Duncan
> @implementation NSData (NSDataDigestCategory) > - (NSString *)sha1 { > uint8_t digest[CC_SHA1_DIGEST_LENGTH]; > > CC_SHA1([self bytes], [self length], digest); > > // use an uppercase X to get an uppercase hash > NSString *hash = [NSString > stringWithFormat:@"%02

Re: How to encrypt a String to a SHA-1 Encrypted in iPhone

2010-11-28 Thread Aaron Burghardt
Hi, Your implementation should work, but I have a few suggestions for you. * Unless you need HMAC specifically, the function you are using is in . * In general, I think Apple discourages relying on the output of the "description", although I see that the documentation for NSData states that d

Re: How to encrypt a String to a SHA-1 Encrypted in iPhone

2010-11-27 Thread Tharindu Madushanka
Hi, It was just I need to add header. But above code didn't work. But following encoded to SHA-1 correctly.. I would like to know whether it encodes right ? or Not ? +(NSString *)stringToSha1:(NSString *)hashkey{ // Using UTF8Encoding const char *s = [hashkey cStringUsingEncoding:NSU

How to encrypt a String to a SHA-1 Encrypted in iPhone

2010-11-27 Thread Tharindu Madushanka
Hi, In order to get this I found following code, but I need to import some frameworks into my code. Could somebody kindly point how can achieve SHA-1 Encrypted string in iPhone. I get few errors compiling since I do not have necessary framework to use this.. :( +(NSString *)stringToSha1:(NSString