Post Reply 
HP Prime: Programme Check Sums
04-01-2015, 09:37 AM
Post: #1
HP Prime: Programme Check Sums
Displaying my ignorance yet again, I can't find how to see the check sum of an entered programme.

Could a Prime adept please assist & advise where to find this info?
Find all posts by this user
Quote this message in a reply
04-01-2015, 02:31 PM
Post: #2
RE: HP Prime: Programme Check Sums
One way is to sum all of the (ascii values) of the characters in a file, modulo 256. The result is a simple checksum.

You can test the checksum by checking Cksm("Cksm"): which should return a checksum of 249
<or>
Cksm("<your filename here>") which should return a checksum between 0 and 255

If you don't mind a two-step yankee innovation:

Code:

//===============================================
//                 Cksm                         =
//                                              =
//  Simple   File Checksum Generator            =
//  Input:   Filename as quoted string          =
//  Outputs: Sum of all ascii chars modulo 256  =
//                                              =
//===============================================
EXPORT Cksm(fn)
BEGIN 
  L1:=concat({},Programs(fn));
  return ΣLIST(asc(L1(1))) mod 256; 
END;

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)