ForumsSearch



Search results for "Posted by "
Author Message
fobgeorge

Posted Aug 26, 2011 in: one question about generating key!
Score: 0
dear support dept. of toodledo,
it's urgent. I am waiting for your reply.
fobgeorge

Posted Aug 26, 2011 in: one question about generating key!
Score: 0
I was according your description about how to generating the key. but I got a different from your calculation. Of course, mine doesn't work.
Please check my code, see what's wrong with it?

//----------------
//the generation is here:
//key = md5( md5(userPassword)+appToken+sessionToken );

NSString *key=[[NSString stringWithFormat:@"%@%@%@", [password md5],appToken,sessionToken]] md5];


//---------
@interface NSString (myMD5)

-(NSString*)md5;

@end

//---------
#import "myMD5.h"

@implementation NSString (myMD5)

-(NSString*)md5
{
const char *cStr = [self UTF8String];
unsigned char result[16];
CC_MD5(cStr, strlen(cStr), result);
return [NSString stringWithFormat: @"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", result[0], result[1], result[2], result[3], result[4], result[5], result[6], result[7], result[8], result[9], result[10], result[11], result[12], result[13], result[14], result[15]];

}
@end


This message was edited Aug 26, 2011.