This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. TI-Basic => TI-BASIC
Author Message
MrXuj


Newbie


Joined: 09 Jan 2010
Posts: 12

Posted: 09 Jan 2010 05:32:46 pm    Post subject:

Hi there everyone.

Just a while ago, I've been browsing this sub-forum, and found several topics about encryption, yet I found none that really fit with my needs. Or I didn't browse long enough, in that case... Hehe.. Whoops?

Anyway, what I am looking for is a secure way to encrypt numbers, as the save-file my game generates consists of only those put in a list.

My current method is:


  1. Take all items from the list, except the last one, which is the savefile.
  2. Add all those characters to each other. ( e.g. {1,2,3} -> 123 )
  3. Encrypt that number using an algorythm.
  4. When a user loads the game, it does the same encryption and compares.


Of course, I'm assuming the user doesn't delete this entire block of code from the program itself, which would be rather... anti-climatic.

Any suggestions?


Last edited by Guest on 09 Jan 2010 05:33:24 pm; edited 1 time in total
Back to top
DrDnar


Member


Joined: 28 Aug 2009
Posts: 116

Posted: 10 Jan 2010 02:01:16 am    Post subject:

I always thought of global warming as being anti-climatic.

If you want to verify that data hasn't been changed, use a checksum (sum()). If you want to make it non-obvious, do it mod 100 or something, or use some other obscure statistical function. There's no way you can be perfectly sure the user hasn't generated the data elsewhere, as anyone could simply copy the encryption code into another program. The best you can do is discourage the average user from editing it. (Someone once showed me a high high-score in Tetris. I showed them a higher one, and with my name written with lowercase letters. I've also shown people version 5.0 of Mario.)
Back to top
MrXuj


Newbie


Joined: 09 Jan 2010
Posts: 12

Posted: 10 Jan 2010 05:27:16 am    Post subject:

Woops. I meant an anticlimax. The climate top must've gotten to me.

You might think I'm really stupid right now, but ehm.. Where can I find this checksum()?
I used to use sum, but I found the problem with that rather quickly. People could increase stats as long as they decreased another.
So they'd increase an important part and decrease something like (x,y)-coordinates.

I understand people could easily copy the code into another program and generate their own save, the reason why I've tried to make the code as obscure as possible, and writing it on one line, I believe it was called 'flow'.
Back to top
cjgone
Aw3s0m3


Active Member


Joined: 24 May 2006
Posts: 693

Posted: 10 Jan 2010 03:57:58 pm    Post subject:

I don't see the exact point of this, but you can protect your data (scores) using some method you stated above then just checksum your code obscurely so that you know they didn't modify pieces of code that are important for handling hiscores and what not.

You probably can write the checksum for small portions of code by just getting the hex values associated with commands in the codeblock and adding them up in some 16-bit value register. Then compare with some specified data/number.

Can't really think of any way thats worth the time to protect game stats.


Last edited by Guest on 10 Jan 2010 04:02:39 pm; edited 1 time in total
Back to top
ztrumpet


Active Member


Joined: 06 May 2009
Posts: 555

Posted: 10 Jan 2010 04:58:56 pm    Post subject:

I feel the need to point out that this is in Basic, not Asm.

There are many ways to encrpt data, although the majority of them can be easily worked around. I've been able to hack every basic game that I've wanted to...
Back to top
Builderboy2005


Advanced Newbie


Joined: 19 Apr 2009
Posts: 51

Posted: 10 Jan 2010 05:43:52 pm    Post subject:

The general way I usualy do it for all of my games is take tan-1() of the product or all the elements, then slap it on the end of the list. Not foolproof, but it works fairly well for the average user.
Back to top
Galandros


Active Member


Joined: 29 Aug 2008
Posts: 565

Posted: 10 Jan 2010 05:52:46 pm    Post subject:

Usual reply with some link to some awesome site:
http://tibasicdev.wikidot.com/saving

An interesting trick the page suggests is to sum all elements except the last.
Also take attention in the change of mode to radian/degrees because that can make corrupt save games when you try to load in a different mode.

The tricks posted above should work. Your check will never get to be impossible to break but doing a simple one is enough for preventing easy cheating. If someone wants to spoil the game fun, they will do it.
Back to top
jakethepspguy


Advanced Newbie


Joined: 04 Aug 2008
Posts: 50

Posted: 13 Jan 2010 03:49:23 am    Post subject:

To shake things up, why not use randInt(1,10,5) for a simple keygen that you store to an archived list and then apply that to the checksum, which would be the last element in the list. The user would be tripping over themself so hard when you used sum(L2)+sum(seq(L1(X),X,1,dim(L1)-1)) to get your sum. Smile
Back to top
Display posts from previous:   
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are UTC - 5 Hours

 

Advertisement