home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / lang / pascal / 8045 < prev    next >
Encoding:
Internet Message Format  |  1993-01-11  |  1.4 KB

  1. Path: sparky!uunet!stanford.edu!rutgers!psuvax1!psuvm!jdg111
  2. From: JDG111@psuvm.psu.edu
  3. Newsgroups: comp.lang.pascal
  4. Subject: Re: CRC values in Turbo PASCAL
  5. Message-ID: <93011.140320JDG111@psuvm.psu.edu>
  6. Date: 11 Jan 93 19:03:20 GMT
  7. References: <1993Jan6.202931.6292@cs.unca.edu>
  8.  <1993Jan8.120512.15614dave@tygra.Michigan.COM>
  9. Organization: Penn State University
  10. Lines: 14
  11.  
  12. > Does anyone know how to calculate CRC values in pascal?
  13.  
  14.    If you're attempting to "protect" your program from being hex edited, there
  15. is a pretty simple way to do it.  I recently sat down and wrote a program, call
  16. ed CRC, which simply reads in a file of type byte, and adds the values of all t
  17. he bytes into a LONGINT variable.  THis longint variable is converted to a 10 d
  18. igit string, excrypted, and appened to the end of the EXE program that is to be
  19.  protected.  The EXE contains code to read all the bytes of itself, and add the
  20. m up, just like the CRC program.  However, it subtracts the last 10 bytes, beca
  21. use that is the CRC number.  It converts the excrypted crc number back into a l
  22. ongint, and compares it's total with the correct total.  If they are off, you'l
  23. l know.  Of course, this method certainly isn't bulletproof, but it helps prote
  24. ct your code from hacking or cracking.  On the other hand, if you were refering
  25. to actual CRC checks of data over communications lines, sorry, can't help ya.
  26.