Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: HybridFox on November 04, 2013, 03:17:36 pm

Title: How to protect your lists?
Post by: HybridFox on November 04, 2013, 03:17:36 pm
So i made this program "SimCity47" And i want to Distribute it with my friends, but since i and my friends are in a coding school, the will probably start cheating with it and chaging the vars and lists, so anyone knows a good way to protect lists?

Thnx in advance ^-^  ::)
Title: Re: How to protect your lists?
Post by: Sorunome on November 04, 2013, 03:20:26 pm
I don't think there is a way with TI-BASIC, sorry.
Title: Re: How to protect your lists?
Post by: HybridFox on November 04, 2013, 03:23:24 pm
I don't think there is a way with TI-BASIC, sorry.

Isnt there also a way to like copy the list, reverse the order and save it to like example "LCS47B" and then when u run the program, it unreverses it and checks if the 2 lists are the same?
Title: Re: How to protect your lists?
Post by: Sorunome on November 04, 2013, 03:24:46 pm
That would be implementing your own 'encryptions' for that list, you could of cource do that and come up with your own algorythm for it ;)
Title: Re: How to protect your lists?
Post by: HybridFox on November 04, 2013, 03:27:56 pm
Hmmmmm, well i would sure think of that ;) it just i never worked with encryption :/
Title: Re: How to protect your lists?
Post by: Sorunome on November 04, 2013, 03:32:02 pm
another posibility would be to use basic libs and store your data to an app-variable so that they can't modify it, or, if you don't want to stick with basic you could start learning axe and create your own data-structures :)
Title: Re: How to protect your lists?
Post by: harold on November 04, 2013, 03:32:28 pm
How about a simple checksum? For example, append -Sum(list) to the end, then when loading you can check whether the sum is zero (or with some tolerance, if necessary)
Title: Re: How to protect your lists?
Post by: HybridFox on November 04, 2013, 03:34:01 pm
another posibility would be to use basic libs and store your data to an app-variable so that they can't modify it, or, if you don't want to stick with basic you could start learning axe and create your own data-structures :)
I know axe a bit, and i learned it, but i just don't like it, i prefer to code in asm on my PC

How about a simple checksum? For example, append -Sum(list) to the end, then when loading you can check whether the sum is zero (or with some tolerance, if necessary)
Not a bad idea, i'll try that
Title: Re: How to protect your lists?
Post by: Xeda112358 on November 04, 2013, 03:35:01 pm
There is basically no protection against knowledgeable TI-BASIC programmers. However, if you think they will be too lazy to check the source code, you could use some kind of checksum method. For example, if the list is always 25 elements of the data, the 26th element could work as the checksum:
Code: [Select]
0→L1(26
sum(L1
Ans-247iPart(Ans/247→L1(26
Then to see if the data has been tampered with:
Code: [Select]
L1(26→A
sum(L1)-A
If A≠(Ans-247iPart(Ans/247
Return

However, that won't prevent a user from incrementing one list element and then decrementing the next. For that, you could do something more complicated like squaring each element, adding 1, then multiplying all of the elements together, modulo 247 and use that to check if the data has been tampered with.
Title: Re: How to protect your lists?
Post by: HybridFox on November 04, 2013, 03:40:45 pm
I think that will do ;) they are indeed lazy enough to check the source code, thanx for the help ^-^
Title: Re: How to protect your lists?
Post by: Keoni29 on November 04, 2013, 03:41:58 pm
If someone can see the source encryption of any kind is no use :P
Title: Re: How to protect your lists?
Post by: HybridFox on November 04, 2013, 03:43:04 pm
If someone can see the source encryption of any kind is no use :P
I know, but my classmates are to lazy to find the encryption code, or i just protect the program ;P
Title: Re: How to protect your lists?
Post by: josh landers on November 04, 2013, 05:58:42 pm
You do need to consider if the number of elements being change will cause any dim errors. You could make a second list that holds the sum and a 1 or 0. You could then  get the sum of the variables list check it to the othe r list and if  the send element is 0 ignore results if 1 exit the program. If you lock the program then you could force a divide by zero error to frustrate their lazy effort to even change the list in the first place, they will tet a divide error and can't even enter the source to remove it.
Title: Re: How to protect your lists?
Post by: Keoni29 on November 04, 2013, 06:42:05 pm
How about private key encryption? This way the program can read the data using a public key, but for editing you need a private key. Look it up on google.
Title: Re: How to protect your lists?
Post by: Hexatron on November 05, 2013, 02:28:51 am
How about this :
1. Set up list
{1,2,3,4->L1
2. Take the list and turn it into a matrix:
For(I,1,4,1
  L1(I)->[A](I,1
end
3. Rotate the numbers around a bit
For(I,1,4,1
  rowSwap([A]
end
4. Store back to list
Matr►list([A],L1
5. Delete Vars
Delvar[A]DelvarL1DelvarI
6.???
7. PROFIT.
Title: Re: How to protect your lists?
Post by: HybridFox on November 05, 2013, 02:08:00 pm
The problem is, i have a game, and during the game it saves over 100 vars, it doesnt save like on one point everything, and that's mostly the problem, i should think of brigning a save function in...
Title: Re: How to protect your lists?
Post by: Hexatron on November 05, 2013, 05:29:20 pm
Yea for something that big you'd just need a lib to convert list > appvar, that seems the best way to do it.