简体   繁体   中英

Making an uneditable gamesave file

What I am doing is making a console blackjack for fun. I want to save the money so users can play day by day but I don't want to save it in a text file where the user can easily change the amount as they please.

I already thought of making a hidden file or a encrypted file with a password but I don't like that. I want it to be sort of like when you open some random dll file, all you see is gibberish that you can't understand.

A bulletproof way to prevent users from tampering with their stats is to store stats away from them, on a remote server. This will require users to be online during play, though. OTOH you'd be able to show a ladder of top players and so on.

An encrypted file is probably the best route if you want offline storage. You just need to hide the file properly.

Before modifying the file, read its modification time. After the update, restore the time. The user will have harder time figuring out which file has changed.

Use an innocent file used by your game with a data block inside allowed by format. It could be an XML file storing the encrypted string in a comment. It could be a JPG or PNG file storing the encrypted string in a comment or EXIF section, at a known offset (so you don't need to parse the file). WAV, OGG, MP3 also allow inclusion of non-interpreted data. This is not real steganography when you hide your data inside the actual pixel values and such, and is far easier.

I suppose you understand that a determined cracker with a disassembler and a debugger can crack this scheme. But an average user probably won't bother.

听起来您在谈论隐秘术 ,但是传统的加密可能更安全,更容易实现。

您可以加密文件中的值:看一下: http : //dinofilias.com/encrypt.htm使用这种基本加密,只要用户无法访问密钥,您的数据就相对安全。

You can get the effect of having a file that contains gibberish using encryption. Just save the encrypted data as bytes (not converted to ASCII representation). Since the encrypted data can have values between 0x00 and 0xFF, there will be gibberish.

Here is a simple example of how to encrypt text: http://www.exampledepot.com/egs/javax.crypto/desstring.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM