8
Ho trovato questa funzione md5 qui: http://www.makebetterthings.com/iphone/how-to-get-md5-and-sha1-in-objective-c-ios-sdk/iOS: Objective-C MD5 NSString
- (NSString *) md5:(NSString *) input
{
const char *cStr = [input UTF8String];
unsigned char digest[16];
CC_MD5(cStr, strlen(cStr), digest); // This is the md5 call
NSMutableString *output = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
for(int i = 0; i < CC_MD5_DIGEST_LENGTH; i++)
[output appendFormat:@"%02x", digest[i]];
return output;
}
ho la firma nel mio file di intestazione come questo:
- (NSString *) md5:(NSString *) input;
Non ci sono errori che rivelano in xCode, tranne dove cerco di usare la funzione.
NSString *credentials = [md5 @"test"];
ricevo il seguente messaggio: l'uso di identificatore non dichiarato 'md5'
Come si usa questa funzione?
@ H2CO3: Questo sarà tornare utile per lui, che cosa dire http: // StackOverflow .com/questions/13575037/what-are-resources-per-learning-objective-c –
@ H2CO3: hai visto la mia domanda qui http://stackoverflow.com/questions/15392726/does-synchronized-guarantees-for- thread-safe-o-no –