Author Topic: CheckSums in Axe?  (Read 11366 times)

0 Members and 1 Guest are viewing this topic.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
CheckSums in Axe?
« on: September 14, 2010, 07:53:32 pm »
First off, what exactly is a checksum on a calculator? What does it check and how does it work?

And, can it be calculated using Axe? If so, how exactly would I perform a checksum on all programs in either RAM or Archive, but only the programs and nothing else?

Then, how would you perform a checksum on the operating system?

**I would like to do this in Axe, if possible.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #1 on: September 14, 2010, 07:56:35 pm »
Checksum? There are several forms. The simplest is the sum of all bytes mod 16.
Example code that displays the checksum of prgmTEST in RAM:
Code: [Select]
GetCalc("prgmTEST")->P
0->A
{P-2}r+P-1->E
For(X,P,E
A+{X}->A
End
Disp A>Dec
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #2 on: September 14, 2010, 08:01:16 pm »
And what should the sum be? How do I use it to decide if something is not right?

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #3 on: September 14, 2010, 08:04:35 pm »
It depends on what you're checksumming ;D
In short, you'd calculate it for the normal version, and check with something else.
Also, there are more advanced algorithms which make faking more difficult. (The checksum example I gave is more for error-checking than anything else, and is easily bypassed) However, I'm not sure how practical some of them are.
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #4 on: September 14, 2010, 08:08:15 pm »
Ok. What sort of errors would your above method check for?

And can the OS itself be checksummed in Axe, or would that need asm?

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: CheckSums in Axe?
« Reply #5 on: September 14, 2010, 08:15:50 pm »
Every checksum is different. It all depends on the guy who made it.




Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #6 on: September 14, 2010, 08:17:41 pm »
Typically transmission errors (TI's transfer protocol uses it).
It can as soon as the degree sign (for address-of) becomes official. (You have to be able to select an arbitrary page, which can be done by manually setting a "file pointer")
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #7 on: September 14, 2010, 08:19:33 pm »
Could someone, if they have the time, write an asm routine that calculates a simple checksum of the OS and saves it to an appvar, "BChkSav", overwriting an old one if it is found. If it isn't too much of a problem. It might be an interesting addition to a secret program I am working on.

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: CheckSums in Axe?
« Reply #8 on: September 14, 2010, 09:03:32 pm »
Could someone, if they have the time, write an asm routine that calculates a simple checksum of the OS and saves it to an appvar, "BChkSav", overwriting an old one if it is found. If it isn't too much of a problem. It might be an interesting addition to a secret program I am working on.
Your better off with something like an MD5 hash, as a checksum could be easily foiled by adding an extra word somewhere so the checksums align themselves.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #9 on: September 15, 2010, 10:03:28 am »
Well, what exactly does an MD5 hash do?

And, in that case can someone please write one for the OS, since I don't know asm.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #10 on: September 15, 2010, 06:57:08 pm »
MD5... that seems to be a bit too much :P
It's another hash function, and has some desirable features including the difficulty of making something with a certain hash.
Only problem is computing it will take a bit longer than you would probably like (probably on the scale of a couple programs a second) because it involves 32-bit calculations, which are more difficult in Axe.
However, MD5 is not very secure (a few seconds on a modern PC to break it), and moving to SHA-2 is, best put, ridiculous.
It mainly depends on the protection you want. If you want more than a simple checksum or variations thereof, I can only think of MD5...
Somebody else can probably tell you more than I have ;D
Link to documentation on MD5
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #11 on: September 16, 2010, 06:34:20 pm »
What would be the best sort of a check to search for basic errors or changes in OS data due to a badly written or malicious program. That's what my goal is.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: CheckSums in Axe?
« Reply #12 on: September 16, 2010, 06:44:39 pm »
Badly written is easy. Malicious is what's difficult.
For badly written, a checksum is more than enough. You just need to increase the size of the checksum to increase security (Though only 2 bytes should be necessary anyway)
Malicious is harder, but by increasing the checksum size to, say, 4 bytes instead of 2, it becomes harder for a program to change the OS without changing the checksum.
I'll write some ASM to create a 2-byte checksum of the OS and return it in hl (for Axe purposes).
* calcdude goes and codes
« Last Edit: October 09, 2010, 05:34:54 pm by calcdude84se »
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline ACagliano

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 919
  • Rating: +32/-2
    • View Profile
    • ClrHome Productions
Re: CheckSums in Axe?
« Reply #13 on: September 16, 2010, 07:30:42 pm »
Thank you very much.


Oh, and question.

Would a properly written OS patch, like the PTT patch change the checksum, or would it only change for something badly written?
« Last Edit: September 16, 2010, 08:04:29 pm by ACagliano »

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: CheckSums in Axe?
« Reply #14 on: September 16, 2010, 08:34:32 pm »
Any change to the OS good or bad would change the checksum. Also, I wouldn't worry about accidental changes to the OS because that is close to impossible to do by accident. Besides, the ones that happen by accident require an OS reinstall because the calculator would not even be able to boot.
zStart v1.3.013 9-20-2013 
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112