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 8008707
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T18:13:20+00:00 2026-06-04T18:13:20+00:00

I really don’t know how it is possible but I am checking two files

  • 0

I really don’t know how it is possible but I am checking two files for their MD5 hashes, so I can determine if they are the same or not.

The problem is that the local file (the file stored in the app bundle) gives the correct value and the one stored on online server is giving bad value. However, if I check the md5 of the online file in Terminal on Mac, or by some internet tool, it gives the correct value.

How is this possible?

This is basically what I am doing.

NSData *currencyData = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://www.iworldtip.com/appl/texts/files/CountryCurrency.plist"]];
NSData *localCurrencyData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"CountryCurrency" ofType:@"plist"]];

NSString *currencyDataHashValue = [currencyData md5];
NSString *localCurrencyDataHashValue = [localCurrencyData md5];

if (![currencyDataHashValue isEqual:localCurrencyDataHashValue]) {
            NSLog(@"Saving new version of currency plist\n\n%@ - %@", currencyDataHashValue, localCurrencyDataHashValue);
...
...

Here is the output:

enter image description here


This is the md5 extension which I am using (found somewhere online):

.h file:

@interface NSString (MyExtensions)
- (NSString *) md5;
@end

@interface NSData (MyExtensions)
- (NSString*)md5;
@end

.m file:

#import "md5Extension.h"
#import <CommonCrypto/CommonDigest.h>

@implementation NSString (MyExtensions)
- (NSString *) md5
{
    const char *cStr = [self UTF8String];
    unsigned char result[16];
    CC_MD5( cStr, strlen(cStr), result ); // This is the md5 call
    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

@implementation NSData (MyExtensions)
- (NSString*)md5
{
    unsigned char result[16];
    CC_MD5( self.bytes, self.length, result ); // This is the md5 call
    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
  • 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-06-04T18:13:21+00:00Added an answer on June 4, 2026 at 6:13 pm

    So, I found out where the problem was.

    First thing is, that I am dumb. I was looking at the output and thought that the problem was the remote file, but the wrong hash was given by the local file!

    Next thing is, that this was caused by a conversion which Xcode does automatically when compiling the project – it converts the XML Plist file to a Binary Plist file. Thus it has a different MD5 hash.

    So the final solution was to convert those remote files to Binary Plists and everything works like a charm!


    PS: I found a great tool for editing Plists – it is called PlistEdit Pro.
    It can do everything you can imagine with the Plists – converts them to binary and vice versa… (I know it can be done in Terminal by plutil, but this is a more convenient solution)

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

Sidebar

Related Questions

I really don't know what I'm doing with SQL, but I have two tables.
I really don't know how to title this question, but I need some help
I really don't know how is it possible, and I couldn't reproduce the error
I really don't know how to express this question. But what I'm trying to
I really don't know how to describe it, but if you understood it and
A really boring question, sorry, but I really don't know that yet ;) I've
Simple question: I really like the idea of encapsulation, but I really don't know
I want to learn VHDL but I really don't know from where to start.
I really don't know what my problem is lately, but Regex seems to be
I really don't know where to begin with this question, but the site I'm

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.