Page 1 of 2

Why I'm Learning Assembly

Posted: Thu 24 Apr, 2008 6:41 am
by waeV
The reason I got into assembly is pretty funny, I think. I planned to make a program in TiBasic and have some form of copy protection on it, and my friend challenged me to make a form of copy-protection that she couldn't break. I accepted, but the problem was that everything I could think of could be easily circumvented by simply editing the copy-protection out of the program. So I was browsing the user manual and discovered the Asm( command and looked it up, finding assembly.

The premise of my program is that there will be some variable on my calculator that the program checks for as it starts to run. If the variable is correct, it displays a congratulations message on the screen. What I consider to be the better part of the program is that if the copy protection fails once, the program rewrites a .db so that the copy-protection will fail every time.

So I'll run it on my calculator, proving it works. then I'll let her copy it over and look for the hidden variable on my calculator, but it won't work when she plugs it in, assuming she runs it at least once! She's going to be banging her head against the wall trying to solve it. :twisted:

Posted: Thu 24 Apr, 2008 7:13 am
by tr1p1ea
Could she possibly just skip passed to variable check? Or even just modify the programs validation data with calcsys.

One way would be to encrypt a portion of the program using the calcs unique ID as a key.

Asm is fun for any reason :).

Posted: Thu 24 Apr, 2008 8:43 am
by qarnos
tr1p1ea wrote:Asm is fun for any reason :).
Z80 asm is fun :twisted:

Posted: Thu 24 Apr, 2008 10:29 am
by King Harold
waeV, you should know that there is no unbreakable copyright protection possible, partly since the cpu will need some starting point to begin doing something with the program. And if the CPU has it, anyone has it. And then, no matter how you encrypted the program, anyone could use the starting point to decrypt (and edit) it, they wouldn't even have to re-encrypt it (since validation code can be removed).

You can make it very hard to break though..

This problem hold for all static data, if communication is involved then it's possible to agree on a shared key without ever sending any data that could be used by a passive-listener to reconstruct the key (unless they solve the discrete logarithm problem)

If you want simple copy protection (to avoid sending over the link), you could try a link hook that refuses to send anything that looks like your program (or anything at all since pattern matching is quite hard), a problem is that hooks can be disabled easily though - unless of course you make the program hack into the OS (with flash-unlock hack) and write it's protective code there. Still, if the program can do it, so can anyone else, but it would at least be hard to break.

Posted: Thu 24 Apr, 2008 5:56 pm
by Dwedit
There's no way to do unbreakable encryption unless it never gets decrypted.

And ARM ASM is at least as fun as Z80. What other instruction set has a "bleq" instruction?

Posted: Thu 24 Apr, 2008 6:57 pm
by King Harold
branch if less or equal?
even x86(-64) asm can be fun, especially SSE (which is so weird it becomes fun, to some people)

SSM asm is not fun though, it only has about 20 instructions! You can't do any proper tricks with it.. boring stack machine..

Posted: Fri 25 Apr, 2008 1:39 am
by waeV
King Harold wrote:waeV, you should know that there is no unbreakable copyright protection possible, partly since the cpu will need some starting point to begin doing something with the program. And if the CPU has it, anyone has it. And then, no matter how you encrypted the program, anyone could use the starting point to decrypt (and edit) it, they wouldn't even have to re-encrypt it (since validation code can be removed).

You can make it very hard to break though..

This problem hold for all static data, if communication is involved then it's possible to agree on a shared key without ever sending any data that could be used by a passive-listener to reconstruct the key (unless they solve the discrete logarithm problem)

If you want simple copy protection (to avoid sending over the link), you could try a link hook that refuses to send anything that looks like your program (or anything at all since pattern matching is quite hard), a problem is that hooks can be disabled easily though - unless of course you make the program hack into the OS (with flash-unlock hack) and write it's protective code there. Still, if the program can do it, so can anyone else, but it would at least be hard to break.
Of the five other people I know in my school who know how to use any kind of programming language (QBASIC / TiBASIC), only one even knew that you could use strings as variables on a ti-calculator.

I think I'm safe. :roll:

Posted: Fri 25 Apr, 2008 9:19 pm
by Liazon
qarnos wrote:
tr1p1ea wrote:Asm is fun for any reason :).
Z80 asm is fun :twisted:
word. wouldn't have it any other way. Although Dwedit, I'm not quite ready to jump from z80 to dual ARMs on DS. I think I'll stick to C for that for now ^^

Posted: Sun 27 Apr, 2008 8:21 pm
by thecheat
perhaps you should encrypt it, at which that variable holds the key to decrypting it... so if it's copied, it's no good, just a bunch of gibberish.

Posted: Mon 28 Apr, 2008 1:35 am
by waeV
That's a good idea, but I want it to say "You Fail" every time she runs it.

Plus, having be gibberish might tip her off to the idea that she needs to copy over the program AND the variable at the same time.

I think if I just put the hidden variable in Str9 or something she won't know how to send it over anyways.

Posted: Mon 28 Apr, 2008 4:48 am
by Dwedit
I think you can also create hidden variables that do not appear in any menus, but can be referred to from TI Basic programs.
Not 100% sure about this though.

Posted: Mon 28 Apr, 2008 8:02 am
by King Harold
Just start the variable name with a space or less ($20 or less, I'm not sure how it reacts to zero though)

Posted: Tue 29 Apr, 2008 10:44 pm
by waeV
Ooh, I'll have to use that one. So the program she'll be copying over only says "Asm(prgm_TEST"

except what could _ be?

Posted: Wed 30 Apr, 2008 7:47 am
by King Harold
If you want it to be completely hidden, an ASCII char less than or equal to $20 (space)
But then you wouldn't be able to do anything with it (you can't even delete it, unless you reset the calc) except from within ASM programs
So a hidden program / appvar could be used as a "secret" variable, but remember that such a secret can not be kept long..

Posted: Tue 06 May, 2008 12:41 am
by waeV
So name it " BREAK" and have another called "BREAK" that calls it up?