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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T10:40:07+00:00 2026-06-12T10:40:07+00:00

We have an app that stores some data localy, none of this data is

  • 0

We have an app that stores some data localy, none of this data is valuable to anyone else except the user and us. So, we don’t need to encrypt it, but we do want to make sure that nobody has changed it.

I figured the easiest way to do this is to generate a hash from file contents, date stamp and/or size. Doing straight md5 is probably not good enough, because who ever wants to change the data could just generate a new hash, so it would be nice to use some sort of the key. Does anybody know of a simple way to do this? I would like to avoid using libraries such as crypto++, but not 100% against it.

Oh, and we are doing the app in C++.

Maybe, I just need to add some obscure data to whatever we pass to the md5 function and be done with this. What do you guys think?

Just to reiterate, file has no valuable info to hackers, so there is no reason to go overboard with security. I just want to check if the settings have been messed with.

Thanks,
Angrius.

PS> does anyone know a good way to implement md5 that would work on both?

  • 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-12T10:40:11+00:00Added an answer on June 12, 2026 at 10:40 am

    The simplest way to do what i wanted to do is to implement basic HMAC (http://en.wikipedia.org/wiki/Hash-based_message_authentication_code). You can even store this hash inside the config file itself, although that’s a bit more complicated, but pretty neat.

    Turns out that both iOS and Android have built in libraries to do basic SHA1, MD5 and so on. They also both support HMAC. So for iOS you would do something like this:

    #include <CommonCrypto/CommonHMAC.h>
    
    string createHMAC( string key, string text )
    {
        string result;
    
        const char *cKey  = key.c_str();
        const char *cData = text.c_str();
        unsigned char cHMAC[CC_SHA1_DIGEST_LENGTH];
    
        CCHmac( kCCHmacAlgSHA1, cKey, strlen(cKey), cData, strlen(cData), cHMAC );
    
        NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * 2];
        for(int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++)
        {
            [output appendFormat:@"%02x", cHMAC[i]];
        }
        result = string( [output UTF8String] );
    
        return result;
    }
    

    Since this is objective-c code, you can compile this as objective-c++ and it will work. If your app doesn’t require any advanced cryptography, there is no need to use any frameworks.

    Cheers,
    Angrius

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

Sidebar

Related Questions

I have built an app that stores dates entered by the user in an
I have a java application that stores some GPS data in a strange format:
I already have an iPhone App that stores data in a file in the
I have an app that has some configuration settings stored in SharedPreference. Now I
I have some things in my app that I need to store, in order
Previously, I have an app that uses core data. I use same store url
I'm building a system that need to collect some user sensitive data via secured
I am storing some objects in core data that have inherent life spans. I
I have an SQLite database for my Android app that stores a copy of
I have a windows application that uses an assembly that stores some configuration settings

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.