home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST317.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  536 b   |  29 lines

  1. ********************
  2.  
  3. FUNCTION Checksum
  4.  
  5.    * Written and contributed by ESSOR MASO
  6.  
  7.    PARAMETERS _astring
  8.  
  9.    IF TYPE("_astring") != "C"
  10.       RETURN("")
  11.    ENDIF
  12.  
  13.    PRIVATE _sum, _l, _qaz
  14.  
  15.    _sum = 0
  16.    _l   = LEN(_astring)
  17.    FOR _qaz =1 TO _l
  18.       _sum = _sum + ASC(SUBSTR(_astring,_qaz,1))
  19.    NEXT
  20.    IF _l = 0
  21.       RETURN(0)
  22.    ELSE
  23.       * 16777216=2^24, 4294967296=2^32
  24.       RETURN((16777216 * _l - 256*ASC(SUBSTR(_astring,1,1))+;
  25.               _sum * 257)%4294967296)
  26.    ENDIF
  27.  
  28. * End of File
  29.