Legend
Forum
Unread topics or posts
Topic
Unread posts
Locked
Announcement
Forum
Unread topics or posts
Topic
Unread posts
Locked
Announcement
Search
Search results for "Posted by brian_1321156451"
| Author | Message |
|---|---|
|
brian_1321156451 |
Posted: Dec 01, 2011
From Topic: one question about generating key!
FYI - do this in the end of my function and it works return [md5String lowercaseString]; Grrrr.... This message was edited Dec 01, 2011. |
|
brian_1321156451 |
Posted: Dec 01, 2011
From Topic: one question about generating key!
-(NSString*)md5ThisString:(NSString*)sString { const char *cStr = [sString UTF8String]; unsigned char result[CC_MD5_DIGEST_LENGTH]; CC_MD5(cStr, strlen(cStr), result); NSString * md5String = [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]]; return md5String; } -(NSString*)sGetToodleKey { NSString * md5Password = [self md5ThisString:@"test"]; NSString* sConcat = [NSString stringWithFormat:@"%@%@%@",md5Password,@"test",@"test"]; NSString * sNewKey = [self md5ThisString:sConcat]; return sNewKey; } So basically, I would expect this 2nd function to return the exact same thing as the calculator for the key in the documentation if I put test,test,test in for all 3 values, but it doesnt...what am I overlooking? |
|
brian_1321156451 |
Posted: Dec 01, 2011
From Topic: one question about generating key!
Did you ever get this resolved. I seem to be doing the same thing. The Documents show the Objective C code for both of the other 2 creations(account lookup and authentication) but dont put the code in for the key. Im sure your md5 function returns the right value for 'test' as mine does, but putting in "test" test" test" in all 3 of the Generating Keys calculator in the documentation returns a different result than doing what we are getting with this call.. ?? Is doing %@%@%@ not correct or something have to be converted to a different string type or ?? Any ideas, this should be easy but it simply doesn't work or has a fairly common mistake in working off of what documentation is given to us.... |