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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:28:37+00:00 2026-05-25T06:28:37+00:00

I am programming a game, and I want highscores to be able to be

  • 0

I am programming a game, and I want highscores to be able to be saved locally, but I dont want the user to be able to go into a plist file and change the values. What is the best way to make it difficult for users to edit the highscores easily. Would making the value an NSNumber that I then write as NSData be sufficient?

  • 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-25T06:28:38+00:00Added an answer on May 25, 2026 at 6:28 am

    AES is probably more trouble than it’s worth here. Much as I respect Jeff LaMarche, this implementation is not good. It’s adequate for this purpose, but it’s not something to copy around in my opinion unless you understand what’s right and what’s wrong with it. I talk about this at length in Properly encrypting with AES with CommonCrypto and include how to do AES correctly; but you probably don’t want the hassle of doing AES correctly here, and it wouldn’t buy you much if you did.

    My recommendation is a simple checksum hash:

    - (NSUInteger)checksumForScore:(NSUInteger)score player:(GKPlayer *)player {
      NSString *string = [NSString stringWithFormat:@"%d%@%@", score, [player playerID], kLongRandomPassword];
      return [string hash];
    }
    

    You then store the checksum along with the score. You validate it like:

    - (BOOL)isValidChecksum:(NSUInteger)checksum forScore:(NSUInteger)score player:(GKPlayer *)player {
      return (checksum == [checksumForScore:score player:player]);
    }
    

    I’ve used GKPlayer playerID here to pick something that’s easy for you to use, but not trivial for the device owner to change while playing. Doing it this way makes replay attack hard. I can’t just copy my friend’s plist entry with it’s super-highscore to my plist. It’s also nicely persistent when the user changes devices or restores this device. If you’re not using GameKit, first, you probably should 😀 and second, you’ll have to figure out if there’s some other key you want to use. A “user handle” would be fine too if you have the user enter that at some point. Anything that’s unique-enough to the user that he wouldn’t just copy his friend’s.

    Keychain is interesting as an obfuscation technique. It’s a royal pain to read even legitimately, so the official SDK provides its own obfuscation 😀 I doubt it’s worth the trouble, but it is a decent place to “hide” small amounts of data.

    NSCoding isn’t even obfuscation. Anyone who’s going to bother to open up the plist can read and write NSCoding in less than a minute. Same for turning this into an NSData. Same for storing it in SQLite or Core Data.

    @CocoaFu’s suggestion of NSDataWritingFileProtectionComplete is clever, but I doubt it will have any real impact on a jailbroken device. Once the device is unlocked, the OS will will decrypt any file for you, so it’s no barrier at all to someone who knows the device’s PIN.

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

Sidebar

Related Questions

I have started looking into iPhone game programming. I want to build a game
Hello everyone I am interested in Java game programming, but I want to do
I am programming a side-scrolling game. I want to be able to control the
I'm fairly new to game programming (but not to programming) and I want to
I'm programming an Android game using AndEngine. I want to create a circle which
LATER EDIT: Please mention not only game programming books, but also more scientific/simulation oriented
This question may have been asked before, but I'm starting to get into game
I am programming a game and want to represent a board using an array.
I'm new to game programming..What I want to achieve is an effect like bubbles
I'm new to game programming. And i have a question. I want to have

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.