ios - How to save url Image in documents with Unique reference -


i've downloaded multiple images url’s . first time download them, want them stored in cache. found following code generate unique reference.

-(nsstring*)cachedimagesystemnameforurl:(nsurl *)url { const char* concat_str = [[url absolutestring] utf8string]; if (!concat_str)     return @"";  unsigned char result[cc_md5_digest_length]; cc_md5(concat_str, (cc_long)strlen(concat_str), result);  nsmutablestring* hash = [[nsmutablestring alloc] init]; (unsigned int = 0; < cc_md5_digest_length; i++)     [hash appendformat:@"%02x", result[i]];  nslog(@"%@",[hash lowercasestring]);   return [hash lowercasestring];  } 

it works didn’t understand technically what's happening in code. i'd appreciate further explanation.

it takes url (string) , generated unique hash out of it, using md5.

try setting breakpoints , print statements, following logic of code should straightforward.


Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -