Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 249037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T21:23:34+00:00 2026-05-11T21:23:34+00:00

Using the iPhone SDK, I’m having the user select images from the image picker.

  • 0

Using the iPhone SDK, I’m having the user select images from the image picker. If the user selects an image they’ve selected before, I’d like to make the user aware of it.

My initial plan (just to make sure other things work for now) is to save the image to a file (need to do this anyway for other reasons), using a checksum of the NSData as the filename. Then, when they select the same image later on, the checksum will be the same and so I can see that a file with that name already exists – hurrah!

However, I’ve scoured the internet and the Apple docs for how to compute a checksum from a NSData. I know I could implement my own implementation, but I’d prefer to avoid that, if possible. I’m also happy for other ideas of how to check that two UIImages are the same.

EDIT

Two years ago I promised a code sample, and here it is. Really sorry for the delay! 🙂

+(NSString*)imageIdForData:(NSData*)data
{
        char* result = (char*) [[data MD5Sum] bytes];

        NSString* hash =  [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 hash;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T21:23:34+00:00Added an answer on May 11, 2026 at 9:23 pm

    In the <CommonCrypto/CommonDigest.h> header file there should be a CC_MD5 function that will compute an MD5 hash of arbitrary data. It’s a C function, so it won’t work directly on an NSData, but it should do what you need.

    Some more info here (including a wrapper using NSString – should be easy enough to convert to use NSData)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 119k
  • Answers 119k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your approach #1 is the best way, and the most… May 11, 2026 at 11:47 pm
  • Editorial Team
    Editorial Team added an answer You can't put straight binary data into an XML document.… May 11, 2026 at 11:47 pm
  • Editorial Team
    Editorial Team added an answer NHibernate has a version strategy for optimistic locking: http://ayende.com/Blog/archive/2009/04/15/nhibernate-mapping-concurrency.aspx May 11, 2026 at 11:47 pm

Related Questions

Using the iPhone SDK, I'm having the user select images from the image picker.
I am using the iPhone SDK and have an issue doing something simple. I
I am using the example from TheElements sample code provided with the iPhone SDK
How would I expose an Objective-C method within JavaScript when using the iPhone SDK
Is there a way using the iPhone SDK to get WiFi information? Things like

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.